sschmid / Entitas

Entitas is a super fast Entity Component System (ECS) Framework specifically made for C# and Unity
MIT License
7.08k stars 1.11k forks source link

Jenny Code Generation sometimes takes extremely long (200 seconds instead of 5) #939

Closed ghostbutter-games closed 1 year ago

ghostbutter-games commented 4 years ago

Hi,

I have a problem with Jenny sometimes taking forever to generate the code. The things I do are: Open cmd line > Jenny.exe gen This usually generates about 200 files in ~5 seconds. Only problem is, about 50% of the time, but never on the first try, it takes almost exactly 200 seconds.

Is this a known issue? I have used Entitas for a couple of years now and this only started happening recently after I upgraded both Rider (to 2019.3) and Unity (to 2019.3.2f1)

Can anyone look into this?

Cheers

WeslomPo commented 4 years ago

Try to start server listener, instead of using bat file, maybe it need a some kind of warmup ? Also you may see console output.

sschmid commented 4 years ago

I experienced this too, but it's gone for me. I think it has sth to do with roslyn having a hard time parsing the project. Unity -> Open C# project usually fixed it for me.

Does this help?

ghostbutter-games commented 4 years ago

I experienced this too, but it's gone for me. I think it has sth to do with roslyn having a hard time parsing the project. Unity -> Open C# project usually fixed it for me.

Does this help?

I tried Assets -> Open C# Project but it didn't change anything for me. It seems really really random.. I just upgraded my PC and now it's down to 100 seconds, but still..I have no idea what causes this. Firewall can't be the cause because I added exceptions already.

EDIT: The problem seems to be occurring mostly when I create e.g. a new component from within Rider directly, without reloading Unity Editor. When I create a component from within Unity, close Rider then open it again via Unity -> Assets -> Open C# project, then run Jenny.exe gen from within Rider, it seems to work..for now.

sschmid commented 4 years ago

I always create new components in rider without switching to Unity. Did you try deleting the solution and all csproj files and regenerating them with Unity?

ghostbutter-games commented 4 years ago

I always create new components in rider without switching to Unity. Did you try deleting the solution and all csproj files and regenerating them with Unity?

Yes, did try that already. Doesn't seem to change anything. I mean: I used Entitas for ~2 years with not issues at all regarding code generation and this only started happening a couple months ago when I switched Unity and Rider versions..

Phist commented 4 years ago

Hey! I've encountered this issue several months ago. Gentlemen in gitter didn't seem to have it so they didn't help much. But. What I've found myself is that the problem is caused by one of the PostProcessors. It seems to be leaving file resources open and not releasing it's handle. Here is the bastard. Try removing this line from your Jenny.properties and see if it helps.

DesperateDevs.CodeGeneration.Plugins.UpdateCSProjPostProcessor, \

sschmid commented 2 years ago

@Phist hm, are you sure? This post processor only uses File.WriteAllText(), looks fine to me.

@konsuko Can you try with Entitas 1.14.0, it's now using dotnet instead of mono and should run faster:

dotnet Jenny/Jenny.Generator.Cli.dll gen
sschmid commented 1 year ago

I remember having this once, too.

I closed Unity and Rider and resetted my project with

git clean -ffdx

This helped in my case!