Instrumentation Profiler in legacy CAS Model - Fails RRS feed

  • Question

  • I am working on instrumenting .NET web applications using IL rewriting. My profiler injects code into each and every functions and tracks it. 

    The injected code is a function call that resides in a helper assembly which will be present in the GAC. This works perfectly in all the web applications, the problem comes with Sharepoint machine.

    Instrumenting the functions of .NET Framework modules in Sharepoint machine and making them to call the functions that resides in the helper assembly fails with the error below,

    This makes the w3wp of the sharepoint app to crash. But on changing the legacycasmodel to false in the web.config file of the sharepoint application or by adding LoaderOptimization DWORD with 1 solves the problem. 

    I should not go in that way as it is not advisable by Microsoft. I tried adding some security attributes in AssemblyInfo.cs and added permissionsets to the methods of my helperassembly that will be in GAC (as below) . But none helped solving the crash. 

    [PermissionSet(SecurityAction.Assert, Name = "Execution")]
    public static void Func1(int s, int s1, int s2)

    What only is stopping to call the function of my helper assembly in Sharepoint application alone.? How should i resolve this without LoaderOptimization or disabling legacycasmodel ??

    Wednesday, August 29, 2018 11:02 AM

All replies

  • Hi Selva VS,

    Thank you for posting here.

    Since your question is more related to web, you could post a new thread in ASP.NET forum for suitable support.


    The CLR Forum discuss and ask questions about .NET Framework Base Classes (BCL) such as Collections, I/O, Regigistry, Globalization, Reflection. Also discuss all the other Microsoft libraries that are built on or extend the .NET Framework, including Managed Extensibility Framework (MEF), Charting Controls, CardSpace, Windows Identity Foundation (WIF), Point of Sale (POS), Transactions.

    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 MSDNFSF@microsoft.com.

    Thursday, August 30, 2018 2:55 AM
  • Wendy,  This is relevent to this topic only.. This discusses on IL instrumentation and CAS models. 
    Thursday, August 30, 2018 4:54 AM