none
usage of application mixed mode dll in win 2008 fails but the same app runs fine in win 2008 r2. While compiling with /clr option. RRS feed

  • Question


  • Hi,

    Currently we have an application with the following set up, we have a module A [mixed mode dll] compiled with /clr flag and we have another module B [an native code exe] which accesses the module A. The application B fails to run on the win 2008 machine where as the same application runs with out errors on a win 2008 r2 box. Its a 32 bit app. The only change that happened in our env was until recently we used VS 2008 compilers and till then the applications ran fine on both win 2008 and win 2008 r2 machines. But the same application when compiled with VS2010 causes the error to be seen only on a win 2008 box. 

    While trying to narrow down the issue, i tried creating sample application which has a mixed mode dll generated with /clr option, and the content of the dll is just one global function which is exported with _declspec(dllexport).

    The other app i wrote uses the .lib,.h and the dll of the above module to call in the global function written. When i run the exe the application fails with the same error. Just to be clear the projects are being developed using VS2010.

    When i just removed the /clr option using which the module is being compiled the application works fine. Wondering the compilation with /clr generating a mixed mode dll is causing some issues or if i am missing some settings. 

    The same application when i ran from win 2008 r2 env runs fine, i even tried copying the projects to the win 2008r2 box and tried running and it works fine.

    Please do let me know if i could get some help with this regard or what cud be wrong in the env or if its sth a know issue. Also wondering if its being caused some where in the thunking.

    Point to note is that, the control never comes in to the code that i have written, it fails while the modules are loaded itself if my observations are correct. 

    Here is one of the event viewer log when the main app crashed..

    Problem signature: 
      Problem Event Name: APPCRASH 
      Application Name: pscrrun.exe 
      Application Version: 8.53.0.0 
      Application Timestamp: 4fcd78fa 
      Fault Module Name: ntdll.dll 
      Fault Module Version: 6.0.6002.18541 
      Fault Module Timestamp: 4ec3e39f 
      Exception Code: c0000005 
      Exception Offset: 00030226 
      OS Version: 6.0.6002.2.2.0.274.38 
      Locale ID: 1033 
      Additional Information 1: e51a 
      Additional Information 2: 4c0d4d78887f76d971d5d00f1f20a433 
      Additional Information 3: e51a 
      Additional Information 4: 4c0d4d78887f76d971d5d00f1f20a433 

    psccrun.exe - Application Error 
    The application failed to initialize properly(0xc0000005). 

    the same solution/project works in vs2010 with win 2008R2, but not in VS2010 with win 2008. But one thing i wanted to clear is that i think its more of an execution thing, as i just copy the exe and the required dll, to win 2008r2 machine and try to run it there it works fine. If i create the app in win 2008 r2/vs2010 and then i copied over the exe and then ran it in win 2008 the app crashed. 

    Also i tried copying the whole solution from win 2008 r2 machine to win 2008 and vice versa. So i guess the solution settings might be the same. Plus as mentioned above i think its more of an execution thing. As you mentioned it could be a win 2008 environment issue or the issue with the MS .net framework/crt dll's win 2008 machine. 

    Clean and rebuild of the application have also been tried, but the app still crashes.

    The same issue is seen in more than one win 2008 machines, by copying over the exe and the latest crt assemblies have been installed and the app fails.

    Please do let me know if you need any clarifications on this. Since it involves mixed mode dll's i even tried using the SOS/clr dll's which i can load fine in the win2008r2 machine using windbg, but the same when i try it on a win 2008 box it doesnt load properly i guess, when i try a !clrstack or .cordll commands i get errors dealing with clr dll, saying "unsupported mscor dll type mscoree". The sympath are fine and the dll's are very much there. I thought would add this info too, incase it might help as i am trying to figure it out if some settings or more details on exception/crash can be figured out.

    Thanks

    kamalesh.


    kamalesh

    Friday, August 3, 2012 9:47 AM

All replies

  • just in continuation to the above note, i had loaded the sos,clr,mscordacworks using .load cmd and .chain command lists these 3 dll's in them.But still when i run !clrstack it says cant find clr.dll.  The ext path has been set fine too.

    I found a similar post http://social.msdn.microsoft.com/Forums/en-US/clr/thread/f9a2d6d6-f9d1-4d83-91a4-382d70f7d47f  but this is specific to vs2005 where as mine is vs2010 and i have checked the windows updates and it says system up to date.


    kamalesh


    Friday, August 3, 2012 9:48 AM
  • Not sure if this information might help, the same application when used earlier with vs2008 worked fine on the same machine. This issue started happening after we moved to vs 2010.

    Thanks

    kamalesh.


    kamalesh

    Friday, August 3, 2012 9:53 AM
  • Hi Kamalesh,

    I have try to involve another one in this thread, it will take some time. If this is an urgent issue, please try to contact Microsoft here: http://support.microsoft.com/contactus/  

    Thank you for your patience.

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, August 6, 2012 8:18 AM
    Moderator
  • Hi Mike,

    Thanks for your response. Sure Thanks. It is kind of urgent for us, but still i am trying to see if i can figure out on my end by trying out various options and settings in the mean time. Please do let me know if there is any updates/help on this once you have the other person involved.

    Thanks

    kamalesh.


    kamalesh

    Tuesday, August 7, 2012 9:08 AM
  • c0000005 is Access Violation (AV). If you have any native libraries in your app, it is most likely their fault.

    Try to get dump for the AV and look at the call stack where it comes from.

    -Karel

    Thursday, August 9, 2012 4:36 AM
    Moderator
  • Hi Karel,

    Thanks for your resp.

    Following is the call stack i see for a couple of app's i have

    it hits the ntdll dbg brk point first and following is the stack

    ntdll.dll!_DbgBreakPoint@0()
      ntdll.dll!_RtlReportException@12()  + 0x51 bytes
      ntdll.dll!_LdrpInitializeProcessWrapperFilter@8()  + 0xa1b0 bytes
      ntdll.dll!__LdrpInitialize@8()  + 0x172 bytes
      ntdll.dll!@_EH4_CallFilterFunc@8()  + 0x12 bytes
      ntdll.dll!ExecuteHandler2@20()  + 0x26 bytes
      ntdll.dll!ExecuteHandler@20()  + 0x24 bytes
      ntdll.dll!_KiUserExceptionDispatcher@8()  + 0xf bytes
      ntdll.dll!_RtlpWaitOnCriticalSection@8()  + 0x7f bytes
      ntdll.dll!_RtlEnterCriticalSection@4()  + 0x11bd2 bytes
      advapi32.dll!_MapPredefinedHandle@12()  + 0x402 bytes
      advapi32.dll!_RegOpenKeyExInternalW@24()  + 0xbe bytes
      advapi32.dll!_RegOpenKeyExW@20()  + 0x1b bytes
      mscoree.dll!FindLatestVersionWithCallback()  - 0x1944 bytes
      mscoree.dll!FindLatestVersion()  + 0x4c bytes
      mscoree.dll!InitShimImpl()  + 0x646e bytes
      mscoree.dll!GetShimImpl()  + 0x3e0c bytes
      mscoree.dll!__CorDllMain_Exported@12()  + 0xc bytes
      ntdll.dll!_LdrpCallInitRoutine@16()  + 0x14 bytes
      ntdll.dll!_LdrpRunInitializeRoutines@4()  + 0x567 bytes
      ntdll.dll!_LdrpInitializeProcess@8()  - 0x864 bytes
      ntdll.dll!__LdrpInitialize@8()  + 0xf2 bytes
      ntdll.dll!_LdrInitializeThunk@8()  + 0x10 bytes

    When continued to run, 

    ntdll.dll!_RtlpWaitOnCriticalSection@8()  + 0x7f bytes
      ntdll.dll!_RtlEnterCriticalSection@4()  + 0x11bd2 bytes
      advapi32.dll!_MapPredefinedHandle@12()  + 0x402 bytes
      advapi32.dll!_RegOpenKeyExInternalW@24()  + 0xbe bytes
      advapi32.dll!_RegOpenKeyExW@20()  + 0x1b bytes
      mscoree.dll!FindLatestVersionWithCallback()  - 0x1944 bytes
      mscoree.dll!FindLatestVersion()  + 0x4c bytes
      mscoree.dll!InitShimImpl()  + 0x646e bytes
      mscoree.dll!GetShimImpl()  + 0x3e0c bytes
      mscoree.dll!__CorDllMain_Exported@12()  + 0xc bytes
      ntdll.dll!_LdrpCallInitRoutine@16()  + 0x14 bytes
      ntdll.dll!_LdrpRunInitializeRoutines@4()  + 0x567 bytes
      ntdll.dll!_LdrpInitializeProcess@8()  - 0x864 bytes
      ntdll.dll!__LdrpInitialize@8()  + 0xf2 bytes
      ntdll.dll!_LdrInitializeThunk@8()  + 0x10 bytes

    and the faulting location it shows as mscoree.dll module in findLAtestVersionwithcallback().

    But if i let it generate a dump and see in that it shows a stack trace that has breaking while crashing at mfc100ud module.

    If its an issue with the native code, i am not sure how the same application works fine in the win 2008 r2 env but not in a win 2008 env.

    Thanks

    kamalesh.


    kamalesh

    Friday, August 10, 2012 5:46 AM
  • This appears to be a missing dependency of the app on the offending machine. Can you run the dependency walker on the app and make sure the necessary binaries are present to run the application without any failures?


    Trevor Hancock (Microsoft)
    Please remember to "Mark As Answer" the replies that help.

    Wednesday, August 15, 2012 8:40 PM
    Moderator