IL Rewrite fails to load .Net DLL

3

I have built the IL Rewriter for some custom requirement. All it does is

  1. Creates method references for another .Net DLL (newly built custom DLL)
  2. Inject epilogue & prologue for few required methods, they internally call above method references.

Everything works fine with sample Windows form application. However, for the web application, epilogue & prologue are getting injected properly. But, when it gets called, it throws below error -

System.IO.FileLoadException: Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0x80131401)

Somehow, the newly built .Net DLL is not getting loaded for WebApp, while the same is working fine for Windows App.

If I disable IL Rewrite, everything works fine as expected. That means IL Rewrite is causing the error.

Any solution would be much appreciated

c#
asp.net
.net
clr-profiling-api
asked on Stack Overflow Nov 15, 2017 by Hitesh • edited Apr 3, 2019 by valiano

1 Answer

1

I could resolve the issue by setting environment variable

COMPLUS_LoaderOptimization 

to

1
answered on Stack Overflow Nov 28, 2017 by Hitesh

User contributions licensed under CC BY-SA 3.0