.NET Runtime error in event log on running a a win32 process that uses a mixed mode .Net 2.0 assembly which is launched from .Netframework 4.0 using the useLegacyV2RuntimeActivationPolicy RRS feed

  • Question

  • Description:
    Here is the exact error in eventlog:
    ".NET Runtime version 4.0.30319.18033 - There was a failure initializing profiling API attach infrastructure.  This process will not allow a profiler to attach.  HRESULT: 0x80004005.  Process ID (decimal): 2976.  Message ID: [0x2509]."

    The process does work as expected except this error in event log which is a concern though we have not see any issues arising out of this error but we want to proactively deal with it. The reason for running the .Net 2.0 assembly in .Net 4.0 is to avoid the dependency on .Net 2.0 if it is not available on the machine. I want to know a way to get rid off the error in evenlog and also the issues it can possible cause due to the reported error. In advance thanks for your time helping me on this!

    Friday, August 30, 2013 1:20 PM

All replies

  • Hi 1venkata,

    According to your description of the problem, there was a profiler wanted to attach to your process and was refused by your process.

    I have built a project in Net 4.0 using Net 2.0 assembly, and it works fine. My steps goes simple.

    1) Build an assembly using Net 2.0.

    2) Build a WinForm project using the assembly above. Modify the config file as below:


      <startup useLegacyV2RuntimeActivationPolicy="true">

        <supportedRuntime version="v4.0"/>



    3) Run the application, and find nothing more in Event Log.

    So I think this issue was unlikely caused by your code. Could you please show us your build project steps and help us to reproduce your problem?

    By the way, could you please try your application in other computer that has the same cleanly runtime environment to see the result? This will help us to narrow down this issue.

    Best Regards,

    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Monday, September 2, 2013 8:56 AM
  • Dear MSDN team,
    Thank you for responding to this issue.
    Our usage was a bit different than yours but we did use the same config file options that you mentioned and we had to use that config file against wKix32.exe a third party WIN32 native process (i.e., unmanaged process) unlike the way you used a WinForm project. Also, the .Net 2.0 component used is a .dll assembly built using C# exposed as COM component with required registry entires generated by regasm.

    Any help resolving this issue is greatly appreciated.

    Best Regards

    Thursday, September 5, 2013 5:25 PM
  • Hi

    That works in a winform project but it doesn't work in a webapi framework 4.5 project,

    Ive try to put that lines in my web.config and also set the IIS poolapp to enable win32 support =True, but it doesnt work

    Best regards

    Salu2 Sergio T

    Wednesday, May 6, 2015 12:36 PM