本文介绍了IL Rewrite无法加载.Net DLL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我为一些自定义要求构建了IL重写器。它所做的全是

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



  1. 为另一个.Net DLL(新建的自定义DLL)创建方法引用

  2. Inject epilogue&几个必需方法的序言,他们在内部调用上面的方法引用。



样本Windows窗体应用程序的一切正常。但是,对于Web应用程序,结语&序幕正在被正确注入。但是,当它被调用时,它会抛出错误 -

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)





不知何故,新建的.Net DLL没有为WebApp加载虽然同样适用于Windows应用程序。


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


如果我禁用IL Rewrite,一切都正常工作。这意味着IL Rewrite导致错误。

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


任何解决方案都将非常感激

Any solution would be much appreciated


Hitesh

推荐答案

对于您的问题,我发现您的问题已通过以下解决方案自行解决。

For your question, I found that your question has been solved by yourself with the solution below.

更改

COMPLUS_LoaderOptimization 

到 

1

最好的问候,

Wendy


这篇关于IL Rewrite无法加载.Net DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-27 09:09