IL Rewrite to mscorlib crashing w3wp.exe RRS feed

  • Question

  • I have built the IL Rewriter to monitor any file is being opened in ASP.Net WebApp. To do so, I am rewriting IL for a private method called 'Init' in FileStream class in mscorlib. Here, I inject the epilogue/prologue to register a custom callback.

    Injection is working fine. Custom callbacks are also getting called whenever a file is getting opened in Windows Application.

    But, when I do the same for ASP.Net web application, it keeps crashing with the following error -

    System.ExecutionEngineException was unhandled Message: An unhandled exception of type 'System.ExecutionEngineException' occurred in System.Web.dll

    I don't understand if it is working fine with .Net-based Desktop Application, then why it does not work with .Net-based web application i.e. ASP.Net. What is the difference between Web and desktop application?

    Googled for above error does not yield any solution :(

    Tuesday, November 28, 2017 9:49 AM

All replies

  • Hi HiteshDK,

    Thank you for posting here.

    For your question, how do you open the file via the code? Using web Browser or other ways? According to your description, we are not sure you want to monitor server to open the file or client to open the file.

    Please provide more details. We are waiting for your update.

    Best Regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Thursday, November 30, 2017 2:22 PM
  • Hi Wendy,

    To test the IL Rewriter, I have built a simple Hello Word web application. That has one link to download a file. It opens the file using FileStream.Open method.

    I am not able to reach to the download method. the w3wp process is crashing much before that. Probably during dependent assembly loading time.

    Let me know if you need any more info. 



    • Edited by HiteshDK Thursday, November 30, 2017 5:09 PM
    Thursday, November 30, 2017 5:09 PM