Closed edwardforgacs closed 5 years ago
Upon further investigation it would seem that the behaviour of DelegateDecompiler to enumerate all types in the AppDomain causes an immediate exception when using the latest Roslyn compiler in ASP.NET (Microsoft.CodeDom.Providers.DotNetCompilerPlatform), it crashes on the
The following code demonstrates the problem, GetTypes will crash on Microsoft.CodeAnalysis.Scripting.
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
foreach(Assembly assm in assemblies) { Type[] types = assm.GetTypes(); }
Hi @edwardforgacs,
The fix for this bug has already already been included in the develop branch. If, unfortunately, you rely on the nuget package, no new release has been made since 0.24. Unless the maintainers plan to release a new version soon, I would advise to fork the project for your own use, if possible.
Best regards, Max.
DelegateDecompiler was working in a project, now it's not, I suspect after some reference updates. Despite enormous effort in attempting to roll back the reference changes to isolate the issue, we have not been able to get DelegateDecompiler to work at all since.
As soon as the Decompile method is called, a ReflectionTypeLoadException is thrown. The LoaderExceptions show
"Could not load file or assembly 'System.Runtime.Loader, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.":"System.Runtime.Loader, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
Forcibly referencing the above assembly (which does not appear to work properly in .NET Framework 4.7 from Nuget) did not solve the problem, it simply results in an error that a type in this assembly could not be found.
System.Reflection.RuntimeModule.GetTypes(RuntimeModule module) +0 System.Reflection.Assembly.GetTypes() +112 System.Linq.d17d 1.MoveNext() +203
DelegateDecompiler.MethodBodyDecompiler.DecompileVirtual(Type declaringType, MethodInfo method, IList
2.MoveNext() +295 System.Linq.WhereEnumerableIterator
1.MoveNext() +51 System.Linq.Buffer1..ctor(IEnumerable
1 source) +152 System.Linq.1 args) +543 DelegateDecompiler.MethodBodyDecompiler.Decompile(MethodInfo method, Type declaringType) +347 System.Lazy
1.CreateValue() +708 System.Lazy1.LazyInitValue() +184 DelegateDecompiler.DecompileExpressionVisitor.Decompile(MethodInfo method, Expression instance, IList
1 arguments) +61 System.Linq.Expressions.ExpressionVisitor.VisitBinary(BinaryExpression node) +95 System.Linq.Expressions.ExpressionVisitor.VisitBinary(BinaryExpression node) +31 System.Linq.Expressions.ExpressionVisitor.VisitBinary(BinaryExpression node) +31 System.Linq.Expressions.ExpressionVisitor.VisitBinary(BinaryExpression node) +31 System.Linq.Expressions.ExpressionVisitor.VisitArguments(IArgumentProvider nodes) +83 System.Linq.Expressions.ExpressionVisitor.VisitMethodCall(MethodCallExpression node) +56 System.Linq.Expressions.ExpressionVisitor.VisitBinary(BinaryExpression node) +95 System.Linq.Expressions.ExpressionVisitor.VisitUnary(UnaryExpression node) +22 System.Linq.Expressions.ExpressionVisitor.VisitBinary(BinaryExpression node) +95 System.Linq.Expressions.ExpressionVisitor.VisitBinary(BinaryExpression node) +31 System.Linq.Expressions.ExpressionVisitor.VisitLambda(Expression`1 node) +30 System.Linq.Expressions.ExpressionVisitor.VisitUnary(UnaryExpression node) +22 System.Linq.Expressions.ExpressionVisitor.VisitArguments(IArgumentProvider nodes) +83 System.Linq.Expressions.ExpressionVisitor.VisitMethodCall(MethodCallExpression node) +56 DelegateDecompiler.DecompiledQueryProvider.CreateQuery(Expression expression) +60