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

Could not resolve type with token ... expected class System.Threading.CancellationToken #1072

Closed
Atlinx opened this issue Jul 12, 2023 · 10 comments

Comments

@Atlinx
Copy link

Atlinx commented Jul 12, 2023

Hey all, I'm using Unity 2022.3.4f1 and I'm getting the following error when I run generate through the Jenny window in the editor. I'm using the 1.14.1 version of Entitas, and I following the installation steps mentioned in this issue #1055.

image

What's causing this error?

@sschmid
Copy link
Owner

sschmid commented Jul 13, 2023

@Atlinx have a look at #1050

make sure you have dotnet 6.0 installed

https://dotnet.microsoft.com/en-us/download

@Atlinx
Copy link
Author

Atlinx commented Jul 13, 2023

I have dotnet 6 installed and the result is unfortunately still the same. Do I need to delete dotnet 7.0? I'm using a global.json file in the root of the repository which should in theory make all dotnet calls within the project use 6.0.

@sschmid
Copy link
Owner

sschmid commented Jul 14, 2023

Ok, all should work, if you have dotnet 6 and a similar Jenny.properties to Match-One. Please compare your Jenny.properties, it looks like you're using plugins that only work in Unity, like the old reflection-based plugins, same as described #1050

@sschmid
Copy link
Owner

sschmid commented Jul 14, 2023

You can share your Jenny.properties and I can have a look

@Atlinx
Copy link
Author

Atlinx commented Jul 14, 2023

Here's my Jenny.properties for the Match-One repository I cloned locally:

Jenny.SearchPaths = Assets/Entitas, \
                    Assets\Jenny\Editor\Jenny, \
                    Jenny/Plugins/Entitas, \
                    Jenny/Plugins/Jenny, \
                    Jenny\Plugins\Entitas
Jenny.Plugins = Entitas.CodeGeneration.Plugins, \
                Entitas.Roslyn.CodeGeneration.Plugins, \
                Entitas.VisualDebugging.CodeGeneration.Plugins, \
                Jenny.Plugins, \
                Jenny.Plugins.Unity
Jenny.PreProcessors = Jenny.Plugins.ValidateProjectPathPreProcessor, \
                      Jenny.Plugins.Unity.WarnIfCompilationErrorsPreProcessor, \
                      Jenny.Plugins.TargetFrameworkProfilePreProcessor
Jenny.DataProviders = Entitas.CodeGeneration.Plugins.ComponentDataProvider, \
                      Entitas.CodeGeneration.Plugins.ContextDataProvider, \
                      Entitas.CodeGeneration.Plugins.EntityIndexDataProvider, \
                      Entitas.Roslyn.CodeGeneration.Plugins.CleanupDataProvider, \
                      Entitas.Roslyn.CodeGeneration.Plugins.ComponentDataProvider, \
                      Entitas.Roslyn.CodeGeneration.Plugins.EntityIndexDataProvider
Jenny.CodeGenerators = Entitas.CodeGeneration.Plugins.ComponentContextApiGenerator, \
                       Entitas.CodeGeneration.Plugins.ComponentEntityApiGenerator, \
                       Entitas.CodeGeneration.Plugins.ComponentEntityApiInterfaceGenerator, \
                       Entitas.CodeGeneration.Plugins.ComponentGenerator, \
                       Entitas.CodeGeneration.Plugins.ComponentLookupGenerator, \
                       Entitas.CodeGeneration.Plugins.ComponentMatcherApiGenerator, \
                       Entitas.CodeGeneration.Plugins.ContextAttributeGenerator, \
                       Entitas.CodeGeneration.Plugins.ContextGenerator, \
                       Entitas.CodeGeneration.Plugins.ContextMatcherGenerator, \
                       Entitas.CodeGeneration.Plugins.ContextsGenerator, \
                       Entitas.CodeGeneration.Plugins.EntityGenerator, \
                       Entitas.CodeGeneration.Plugins.EntityIndexGenerator, \
                       Entitas.CodeGeneration.Plugins.EventEntityApiGenerator, \
                       Entitas.CodeGeneration.Plugins.EventListenerComponentGenerator, \
                       Entitas.CodeGeneration.Plugins.EventListenerInterfaceGenerator, \
                       Entitas.CodeGeneration.Plugins.EventSystemGenerator, \
                       Entitas.CodeGeneration.Plugins.EventSystemsGenerator, \
                       Entitas.Roslyn.CodeGeneration.Plugins.CleanupSystemGenerator, \
                       Entitas.Roslyn.CodeGeneration.Plugins.CleanupSystemsGenerator, \
                       Entitas.VisualDebugging.CodeGeneration.Plugins.ContextObserverGenerator, \
                       Entitas.VisualDebugging.CodeGeneration.Plugins.FeatureClassGenerator
Jenny.PostProcessors = Jenny.Plugins.AddFileHeaderPostProcessor, \
                       Jenny.Plugins.CleanTargetDirectoryPostProcessor, \
                       Jenny.Plugins.MergeFilesPostProcessor, \
                       Jenny.Plugins.NewLinePostProcessor, \
                       Jenny.Plugins.UpdateCsprojPostProcessor, \
                       Jenny.Plugins.WriteToDiskPostProcessor, \
                       Jenny.Plugins.ConsoleWriteLinePostProcessor, \
                       Jenny.Plugins.Unity.DebugLogPostProcessor
Jenny.Server.Port = 3333
Jenny.Client.Host = localhost
Entitas.CodeGeneration.Plugins.Contexts = Game, \
                                          Input, \
                                          GameState, \
                                          Config
Entitas.CodeGeneration.Plugins.IgnoreNamespaces = false
Jenny.Plugins.ProjectPath = Assembly-CSharp.csproj
Jenny.Plugins.TargetDirectory = Assets
Entitas.CodeGeneration.Plugins.Assemblies = Library/ScriptAssemblies/Assembly-CSharp.dll

I'm also running this in Windows 11 if that makes a difference.

@sschmid
Copy link
Owner

sschmid commented Jul 14, 2023

There are differences in the Jenny.properties compared to the one from Match-One. Same issue as #1050

I recommend using the one from Match-One as a starting point.

E.g. your Jenny.properties contains old and obsolete Entitas.CodeGeneration.Plugins.ComponentDataProvider (and others)

Use the one from Match-One and all should be fine

@sschmid
Copy link
Owner

sschmid commented Jul 14, 2023

Explanation:
The old non-roslyn data providers like Entitas.CodeGeneration.Plugins.ComponentDataProvider and Entitas.CodeGeneration.Plugins.EntityIndexDataProvider have been replaced with the roslyn ones.

They used to be part of the paid Unity Asset store version, but for a while now thats all free and included in the GitHub version, too.

More about this here

@Atlinx
Copy link
Author

Atlinx commented Jul 14, 2023

Ah, overwriting my Jenny.properties with the new Match-One Jenny.properties fixed it! :D
I think the reason why my properties file looks like this is because I pressed auto import in the Jenny window at some point, and I never thought about resetting the properties file to test again with dotnet 6.0.

I'm able to get the generation to run through the CLI command but the editor window is still broken, unfortunately.

@sschmid
Copy link
Owner

sschmid commented Jul 14, 2023

The new roslyn data providers are "too new" to run in Unity, that's why for now ti will only run in the terminal. I think that's fine, because using jenny server is also the fastest way to gerate and the recommended way.
Since your Jenny.properties files contained the old data providers they probably had to load Unity related assemblies (because of reflection). This can work in the terminal, but is not recommended because it basically needs to load Unity. So I will skip instructions to make it work the old way and save you some time ;)

@sschmid
Copy link
Owner

sschmid commented Jul 14, 2023

Fyi, I'm working on replacing Jenny altogether and use c# source generators instead. This will simplify the setup and there won't be any Jenny.properties anymore that causes confusion.

See #1005

Stay tuned!

@sschmid sschmid closed this as completed Jul 14, 2023
@github-project-automation github-project-automation bot moved this from New to Done in Entitas Jul 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants