Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tutorial - "Error: Failed to get test method '' from assembly 'ClientServer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' " #542

Closed
thesammiller opened this issue Dec 6, 2022 · 4 comments

Comments

@thesammiller
Copy link

Trying to run the tutorial, I have run into another issue. I have multiple versions of dotnet but I installed Coyote locally and am using a global.json file to specify 3.1. Any help is appreciated!

~/Development/dotnet/P/Tutorial/1_ClientServer$ pc -proj:ClientServer.pproj        
----------------------------------------
==== Loading project file: ClientServer.pproj                                                                                                                                                           
....... includes p file: /home/smiller/Development/dotnet/P/Tutorial/1_ClientServer/PSrc/Client.p                                                                                                       
....... includes p file: /home/smiller/Development/dotnet/P/Tutorial/1_ClientServer/PSrc/Server.p                                                                                                       
....... includes p file: /home/smiller/Development/dotnet/P/Tutorial/1_ClientServer/PSrc/ClientServerModules.p                                                                                          
....... includes p file: /home/smiller/Development/dotnet/P/Tutorial/1_ClientServer/PSrc/AbstractBankServer.p                                                                                           
....... includes p file: /home/smiller/Development/dotnet/P/Tutorial/1_ClientServer/PSpec/BankBalanceCorrect.p                                                                                          
....... includes p file: /home/smiller/Development/dotnet/P/Tutorial/1_ClientServer/PTst/TestDriver.p                                                                                                   
....... includes p file: /home/smiller/Development/dotnet/P/Tutorial/1_ClientServer/PTst/Testscript.p                                                                                                   
----------------------------------------                                                                                                                                                                
----------------------------------------                                                                                                                                                                
Parsing ...
Type checking ...
Code generation ...
Generated ClientServer.cs.
----------------------------------------
Compiling ClientServer...
Microsoft (R) Build Engine version 16.7.3+2f374e28e for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
  All projects are up-to-date for restore.
  ClientServer -> /home/smiller/Development/dotnet/P/Tutorial/1_ClientServer/POutput/netcoreapp3.1/ClientServer.dll

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:01.22


----------------------------------------
~/Development/dotnet/P/Tutorial/1_ClientServer$ pmc ./obj/Release/netcoreapp3.1/ClientServer.dll
. Testing ./obj/Release/netcoreapp3.1/ClientServer.dll
Starting TestingProcessScheduler in process 1013747
Error: Failed to get test method '' from assembly 'ClientServer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
@thesammiller
Copy link
Author

I tried this again with the output DLL and it errored out. I tried to compile all the tutorials and they all had errors. Most had output similar to the below.

~/Development/dotnet/P/Tutorial/1_ClientServer$ coyote test ./POutput/netcoreapp3.1/ClientServer.dll -m PImplementation.tcSingleClient.Execute -i 1000
Microsoft (R) Coyote version 1.7.1.0 for .NET 6.0.11
Copyright (C) Microsoft Corporation. All rights reserved.

. Testing /home/smiller/Development/dotnet/P/Tutorial/1_ClientServer/POutput/netcoreapp3.1/ClientServer.dll.
Unable to load one or more of the requested types.
Could not load type 'Microsoft.Coyote.Event' from assembly 'Microsoft.Coyote, Version=1.7.1.0, Culture=neutral, PublicKeyToken=c4566cf0a7f74012'.                                                   
Could not load type 'Microsoft.Coyote.Event' from assembly 'Microsoft.Coyote, Version=1.7.1.0, Culture=neutral, PublicKeyToken=c4566cf0a7f74012'.                                                   
Could not load type 'Microsoft.Coyote.Event' from assembly 'Microsoft.Coyote, Version=1.7.1.0, Culture=neutral, PublicKeyToken=c4566cf0a7f74012'.                                                   
Could not load type 'Microsoft.Coyote.Event' from assembly 'Microsoft.Coyote, Version=1.7.1.0, Culture=neutral, PublicKeyToken=c4566cf0a7f74012'.                                                   
Could not load type 'Microsoft.Coyote.Event' from assembly 'Microsoft.Coyote, Version=1.7.1.0, Culture=neutral, PublicKeyToken=c4566cf0a7f74012'.                                                   
Could not load type 'Microsoft.Coyote.Event' from assembly 'Microsoft.Coyote, Version=1.7.1.0, Culture=neutral, PublicKeyToken=c4566cf0a7f74012'.                                                   
Could not load type 'Microsoft.Coyote.Actors.StateMachine' from assembly 'Microsoft.Coyote, Version=1.7.1.0, Culture=neutral, PublicKeyToken=c4566cf0a7f74012'.                                     
Could not load type 'Microsoft.Coyote.Actors.StateMachine' from assembly 'Microsoft.Coyote, Version=1.7.1.0, Culture=neutral, PublicKeyToken=c4566cf0a7f74012'.                                     
Could not load type 'Microsoft.Coyote.Actors.StateMachine' from assembly 'Microsoft.Coyote, Version=1.7.1.0, Culture=neutral, PublicKeyToken=c4566cf0a7f74012'.                                     
Could not load type 'Microsoft.Coyote.Actors.StateMachine' from assembly 'Microsoft.Coyote, Version=1.7.1.0, Culture=neutral, PublicKeyToken=c4566cf0a7f74012'.
Could not load type 'Microsoft.Coyote.Actors.StateMachine' from assembly 'Microsoft.Coyote, Version=1.7.1.0, Culture=neutral, PublicKeyToken=c4566cf0a7f74012'.
Could not load type 'Microsoft.Coyote.Actors.StateMachine' from assembly 'Microsoft.Coyote, Version=1.7.1.0, Culture=neutral, PublicKeyToken=c4566cf0a7f74012'.
Could not load type 'Microsoft.Coyote.Event' from assembly 'Microsoft.Coyote, Version=1.7.1.0, Culture=neutral, PublicKeyToken=c4566cf0a7f74012'.
Could not load type 'Microsoft.Coyote.Event' from assembly 'Microsoft.Coyote, Version=1.7.1.0, Culture=neutral, PublicKeyToken=c4566cf0a7f74012'.
Could not load type 'State' from assembly 'Microsoft.Coyote, Version=1.7.1.0, Culture=neutral, PublicKeyToken=c4566cf0a7f74012'.
Could not load type 'State' from assembly 'Microsoft.Coyote, Version=1.7.1.0, Culture=neutral, PublicKeyToken=c4566cf0a7f74012'.
Could not load type 'State' from assembly 'Microsoft.Coyote, Version=1.7.1.0, Culture=neutral, PublicKeyToken=c4566cf0a7f74012'.
Could not load type 'State' from assembly 'Microsoft.Coyote, Version=1.7.1.0, Culture=neutral, PublicKeyToken=c4566cf0a7f74012'.
Could not load type 'Microsoft.Coyote.Event' from assembly 'Microsoft.Coyote, Version=1.7.1.0, Culture=neutral, PublicKeyToken=c4566cf0a7f74012'.
Could not load type 'State' from assembly 'Microsoft.Coyote, Version=1.7.1.0, Culture=neutral, PublicKeyToken=c4566cf0a7f74012'.
Could not load type 'State' from assembly 'Microsoft.Coyote, Version=1.7.1.0, Culture=neutral, PublicKeyToken=c4566cf0a7f74012'.
Could not load type 'State' from assembly 'Microsoft.Coyote, Version=1.7.1.0, Culture=neutral, PublicKeyToken=c4566cf0a7f74012'.
Could not load type 'Microsoft.Coyote.Event' from assembly 'Microsoft.Coyote, Version=1.7.1.0, Culture=neutral, PublicKeyToken=c4566cf0a7f74012'.
Could not load type 'State' from assembly 'Microsoft.Coyote, Version=1.7.1.0, Culture=neutral, PublicKeyToken=c4566cf0a7f74012'.
Could not load type 'State' from assembly 'Microsoft.Coyote, Version=1.7.1.0, Culture=neutral, PublicKeyToken=c4566cf0a7f74012'.
Could not load type 'Microsoft.Coyote.Event' from assembly 'Microsoft.Coyote, Version=1.7.1.0, Culture=neutral, PublicKeyToken=c4566cf0a7f74012'.
Could not load type 'State' from assembly 'Microsoft.Coyote, Version=1.7.1.0, Culture=neutral, PublicKeyToken=c4566cf0a7f74012'.
Could not load type 'State' from assembly 'Microsoft.Coyote, Version=1.7.1.0, Culture=neutral, PublicKeyToken=c4566cf0a7f74012'.
Could not load type 'Microsoft.Coyote.Event' from assembly 'Microsoft.Coyote, Version=1.7.1.0, Culture=neutral, PublicKeyToken=c4566cf0a7f74012'.
Could not load type 'State' from assembly 'Microsoft.Coyote, Version=1.7.1.0, Culture=neutral, PublicKeyToken=c4566cf0a7f74012'.
Could not load type 'State' from assembly 'Microsoft.Coyote, Version=1.7.1.0, Culture=neutral, PublicKeyToken=c4566cf0a7f74012'.
Could not load type 'Microsoft.Coyote.Event' from assembly 'Microsoft.Coyote, Version=1.7.1.0, Culture=neutral, PublicKeyToken=c4566cf0a7f74012'.
Could not load type 'State' from assembly 'Microsoft.Coyote, Version=1.7.1.0, Culture=neutral, PublicKeyToken=c4566cf0a7f74012'.
Could not load type 'State' from assembly 'Microsoft.Coyote, Version=1.7.1.0, Culture=neutral, PublicKeyToken=c4566cf0a7f74012'.

@thesammiller
Copy link
Author

I am able to get this to work on a different computer. I am assuming there is something wrong with my local setup. I am closing this issue. Thank you.

@martinHornacek
Copy link

@thesammiller

I had similar issue on my Mac with the "Could not load type" errors when running the 'coyote test' command.

In the end the problem was that the Coyote was installed for different version of dotnet (in my case 6.0.11) than the version which was used to build the P tutorials. If you follow the installation guide by running

brew tap isen-ng/dotnet-sdk-versions
brew install --cask dotnet-sdk3-1-400

then the dotnet framework will be 3.1.

You can see which version the Coyote tries to use in the output when running 'coyote test':

Microsoft (R) Coyote version 1.7.1.0 for .NET 6.0.11

I resolved the issue by:

  1. uninstalling Coyote with dotnet tool uninstall --global Microsoft.Coyote.CLI
  2. installing Coyote again with the --framework flag to explicitly use the 3.1 version dotnet tool install --global Microsoft.Coyote.CLI --version 1.0.5 --framework netcoreapp3.1

I am putting my solution here just in case someone stumbles on the same issue.

@ankushdesai This issue could be a common problem for folks using Macs who have already a specific version of dotnet framework installed on their machine.

We could improve the P/Docs/docs/getstarted/install.md and add a note to use the --framework flag when installing Microsoft.Coyote.CLI to make sure the tool is installed for the proper version of dotnet framework.

Would such change make sense? Please let me know what you think. If yes, I'll create a PR.

Thank you.

@thesammiller
Copy link
Author

@martinHornacek I am using Debian/Linux, but I think your point holds about conflicting versions.

Another way to work around this:

  • Install dotnet 3.1 explicitly (so there are multiple versions of the sdk installed)
  • Create a global.json file in the directory of the project.
  • Put the following in the global.json:
{
  "sdk": {
    "version": "3.1.425"
  }
}
  • Install Coyote locally (skip the --global flag)
  • Instead of using alias pmc='coyote test' use alias pmc='dotnet tool run coyote test'
  • The global.json specifies using dotnet 3.1 in the folder and the alias targets the specific version of coyote.

It's been a minute since I found this workaround, so some of these instructions may not be correct, but it does leave the global versions of dotnet and coyote untouched, which may be important for some environments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants