Open maridematte opened 2 months ago
A wrinkle here is that our API has a lot of entry points. However an exception in the evaluator would probably catch almost everything.
Can ModuleInitializerAttribute be used for this? It would cause the exception to be wrapped in TypeInitializationException, though.
.NET Framework does not provide the System.Runtime.CompilerServices.ModuleInitializerAttribute type, but if you define a similar one as internal in MSBuild, then I think Roslyn will recognize it and set up the <Module>::.cctor
method that the runtime will then call.
Originating from https://github.com/dotnet/msbuild/pull/10175 discussion.
The scenario of running .NET Framework MSBuild in a .NET process is unsupported, but it worked until a recent change. Since there is some confusion around this, identifying and breaking this scenario with a specific message would be ideal.