none
Upgrade Server to 4.6.1. getting error System.InvalidProgramException: Common Language Runtime detected an invalid program RRS feed

  • Question

  • I upgraded my Windows 2008 Server to .net framework 4.6.1. I have a multitude of web applications from FW 2.0 - 4.5 running. Once i install all applications now throw the error

    "System.InvalidProgramException: Common Language Runtime detected an invalid program


    I have restarted, recycled app pools, done IISReset and no difference, validated the server is update to date etc. I cant find any solution to this issue. Does anyone have any ideas?


    • Edited by spark29er Wednesday, January 27, 2016 9:56 PM
    Wednesday, January 27, 2016 9:45 PM

All replies

  • Hello spark29er,

    Not so sure whether this is .NET Setup error or your application error.

    Please use the following tool:

    http://blogs.msdn.com/b/astebner/archive/2008/10/13/8999004.aspx

    The tool can help you verify .NET 4.6.1. Please check the first 15 lines and the last 15 lines from the verify tool. If .NET installed without problem then you may have to remove applications one by one to find the reason out.

    Best regards,

    Barry


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, January 28, 2016 8:09 AM
    Moderator
  • The error occurs on every application and we have about 35 that have been running with no issues until i installed this last framework update.I can try this tool and see what happens

    Thursday, January 28, 2016 3:05 PM
  • @spark29er,

    What's the result? Please also try repair your .NET Framework from control panel.

    And if .NET 4.6.1 has errors, you can submit your error log to us by using collect.exe tool. Here is a blog about how to use it:

    https://blogs.msdn.microsoft.com/heaths/2009/05/20/microsoft-vs-net-log-collection-tool/

    Best regards,

    Barry


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, February 2, 2016 8:04 AM
    Moderator
  • I ran the verification tool last night after install and it said it was successful and the log looks ok.

    I did an experiment and deployed a new 4.6 application after i installed the 4.6.1 framework to the server and it worked. But all of my 4.0+ applications that exist previously on the server no longer work and display the "Common Language Runtime detected an invalid program. ". I did IIS Reset and aspnet reg etc to no avail. I restarted application pools, and even tried recreating new app pools for the affected applications and same result. I cant uninstall these applications as this is a prod environment. Any other ideas?

    Here is one of the exception details:

    System.ServiceModel.ServiceHostingEnvironment+HostingManager/63835064
    System.ServiceModel.ServiceActivationException: The service '/TESTService.svc' cannot be activated due to an exception during compilation. The exception message is: Common Language Runtime detected an invalid program.. ---> System.InvalidProgramException: Common Language Runtime detected an invalid program. at System.ServiceModel.Dispatcher.DispatchRuntime..ctor(SharedRuntimeState shared) at System.ServiceModel.Dispatcher.DispatchRuntime..ctor(EndpointDispatcher endpointDispatcher) at System.ServiceModel.Dispatcher.EndpointDispatcher..ctor(EndpointAddress address, String contractName, String contractNamespace, Boolean isSystemEndpoint) at System.ServiceModel.Description.DispatcherBuilder.BuildDispatcher(ServiceHostBase service, ServiceDescription serviceDescription, ServiceEndpoint endpoint, ContractDescription contractDescription, EndpointFilterProvider provider) at System.ServiceModel.Description.DispatcherBuilder.InitializeServiceHost(ServiceDescription description, ServiceHostBase serviceHost) at System.ServiceModel.ServiceHostBase.InitializeRuntime() at System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout) at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) at System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(ServiceActivationInfo serviceActivationInfo, EventTraceActivity eventTraceActivity) at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity) --- End of inner exception stack trace --- at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity) at System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailableFast(String relativeVirtualPath, EventTraceActivity eventTraceActivity)
    w3wp
    3012

    Tuesday, February 2, 2016 3:29 PM
  • Hello spark29er,

    By default .NET 4.6.1 will include .NET 4.0 feature. And since your problem is related to your web applications it is hard for me to track. Who is the developer of your 4.0 applications?

    Can you do this test: switch to use another machine which has .NET 4.6 installed and run your 4.0 applications. Let's see if you can reproduce the same issue.

    On your server, I think you need to check one thing: The service. The exception is related to connect to a service from your app. There are settings that have been modified after you update to .NET 4.6.1. To know which setting, If you are the developer you can debug your app and that will help us find the reason faster.

    By the way, installation itself seems do not have problem.

    Best regards,

    Barry


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, February 4, 2016 2:51 AM
    Moderator
  • We are also facing this issue, exact same symptoms.

    I can add a few insights though:

    1. The issue happens when a binary compiled with pre-Roslyn compiler is run on .NET 4.6.1. Works fine on .NET 4.5.2.
    2. Recompiling the same program with Roslyn compiler produces a binary that runs on .NET 4.6.1 correctly.
    3. The issue only happens for binaries compiled with optimizations turned on (aka "Release mode").
    4. The particular spot in which we are getting the issue is inside an async/await-generated state machine. We do not get the issue in any other spots. (I'm not sure if this is meaningful or just a coincidence).
    5. We get the issue during our unit test run, but only when we execute the whole test suite consisting of multiple assemblies. If we limit the run to just the problematic assembly (or even several assemblies, but not all), the issue does not reproduce. This makes me think that the issue must depend on the order of JIT-compilation.
    6. For the above reason, I cannot offer a minimal repro (too much time to minimize it). However, I would be willing to help with debugging - i.e. try workarounds, provide dumps, etc.



    Friday, May 6, 2016 3:04 AM