Failed to load the test bundle when running the xcodebuild -project

I have updated to the v1.17.1-beta.0, Since then I cannot run a test on a real device.
So far I have tried to downgrade the version to:
1.15.0
1.15.1
1.13.0
1.17.0
Then I have followed the XCUITest Driver Real Device Setup from the scratch.

Whenever I run the

  xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'id=<udid>' test

I get the following result

Testing failed:
WebDriverAgentRunner:
WebDriverAgentRunner-Runner.app (379) encountered an error (Failed to load the test bundle. (Underlying error: The bundle “WebDriverAgentRunner” couldn’t be loaded because it is damaged or missing necessary resources. The bundle is damaged or missing necessary resources. dlopen_preflight(/var/containers/Bundle/Application/14851F2A-8FB2-4845-9A20-410C9463CEB3/WebDriverAgentRunner-Runner.app/PlugIns/WebDriverAgentRunner.xctest/WebDriverAgentRunner): no suitable image found. Did find:

/var/containers/Bundle/Application/14851F2A-8FB2-4845-9A20-410C9463CEB3/WebDriverAgentRunner-Runner.app/PlugIns/WebDriverAgentRunner.xctest/WebDriverAgentRunner: code signature invalid for '/var/containers/Bundle/Application/14851F2A-8FB2-4845-9A20-410C9463CEB3/WebDriverAgentRunner-Runner.app/PlugIns/WebDriverAgentRunner.xctest/WebDriverAgentRunner'

Or if I run the test I get the following error:

Encountered internal error running command: Error: Unable to launch WebDriverAgent because of xcodebuild failure: xcodebuild failed with code 65

appium log

appium - Version 1.17.1-beta.0
Xcode - Version 11.3.1 (11C504)
ios version 13.3.1

I was managed to solved this by updating the xcode to the latest one.