maca88 / AsyncGenerator

Generating async c# code using Roslyn
MIT License
47 stars 16 forks source link

Seems to not work with VS 2017 15.9.15 #132

Closed fredericDelaporte closed 5 years ago

fredericDelaporte commented 5 years ago

Checked with AsyncGenerator 0.15.0, 0.14.0, 0.8.2.11 and 0.8.2.4, I cannot generate async anymore:

     [exec] 10:24:03,091 INFO  CommandLine:0 - AsyncGenerator
     [exec]
     [exec] 10:24:03,187 FATAL CommandLine:0 - System.InvalidOperationException: Visual Studio installation directory was not found. Install Visual Studio or set the environment variable VSINSTALLDIR
     [exec]    à AsyncGenerator.Internal.EnvironmentHelper.Setup()
     [exec]    à AsyncGenerator.CommandLine.Program.Main(String[] args)

I have currently VS2017 Community 15.9.15, no VS2019. I have updated to 15.9.15 this week, but maybe the trouble is older.

I have also tried to set VSINSTALLDIR (to C:\Program Files (x86)\Microsoft Visual Studio\2017\Community), but with 0.15.0, it then yields:

     [exec] 10:20:46,026 INFO  CommandLine:0 - AsyncGenerator
     [exec]
     [exec] 10:20:47,223 INFO  AsyncCodeGenerator:0 - Generating async code started
     [exec] 10:20:48,017 FATAL CommandLine:0 - System.Reflection.ReflectionTypeLoadException: Impossible de charger un ou plusieurs des types requis. Extrayez la propriété LoaderExceptions pour plus d'informations.
     [exec]    à System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
     [exec]    à System.Reflection.RuntimeAssembly.get_DefinedTypes()
     [exec]    à System.Composition.Hosting.ContainerConfiguration.<>c.<WithAssemblies>b__16_0(Assembly a)
     [exec]    à System.Linq.Enumerable.<SelectManyIterator>d__17`2.MoveNext()
     [exec]    à System.Composition.TypedParts.TypedPartExportDescriptorProvider..ctor(IEnumerable`1 types, AttributedModelProvider attributeContext)
     [exec]    à System.Composition.Hosting.ContainerConfiguration.CreateContainer()
     [exec]    à Microsoft.CodeAnalysis.Host.Mef.MefHostServices.Create(IEnumerable`1 assemblies)
     [exec]    à Microsoft.CodeAnalysis.Host.Mef.DesktopMefHostServices.get_DefaultServices()
     [exec]    à AsyncGenerator.AsyncCodeGenerator.CreateWorkspace(String targetFramework)
     [exec]    à AsyncGenerator.AsyncCodeGenerator.<GenerateAsync>d__0.MoveNext()
     [exec] --- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée ---
     [exec]    à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
     [exec]    à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
     [exec]    à AsyncGenerator.CommandLine.Program.Main(String[] args)

(The exception message means Unable to load one or more required types.)

Maybe like for #74, I need to do a full re-install, but I have not tried yet. Has anyone else this issue?

maca88 commented 5 years ago

I've updated VS2017 to 15.9.15 on my other computer that does not have VS2019 installed and the generator is still working. If you have NETCore 2.1 or higher installed you can try to generate nhibernate/nhibernate-core/pull/2182 to see if the issue is still there and if it is, the exception should contain also the inner exceptions. I've appended the inner exceptions of ReflectionTypeLoadException in the log for .NET.

fredericDelaporte commented 5 years ago

There are no issue with 0.16.2, while the trouble was persisting with other versions.

But moreover, willing to attempt a "repair", I am gone into VS Installer, and before I have done anything it has asked me for a reboot to "finish the install". Well I had already reboot a couple of times since the last update, but obviously there was still something unfinished since then. Does it need to reboot through its own button? I hope that was not that stupid.

Any way now it works for all version. Sorry for the undue report.