none
DLL in unmanaged code (c#) fails in Windows 7 system RRS feed

  • Question

  • I have  a c# program, developed with Visual Studio 2005, that accesses a C++ DLL.  The process works fine in XP and on one Windows 7 system (Windows 7 professional) so I know the DLL works under Windows 7.  However, another Windows 7 (Windows 7 Home) crashes everytime the DLL is accessed. It is imported ok and I even have a try,catch loop around the code, but the Windows 7 always intercepts and calls it a AppCrash. I know it fails at the point the DLL is read because I have a trace in the code. I don't see anything different in permissions between the two Windows 7 systems and I am at a loss at what it could be. Is there anything else I could look for?
    Monday, February 28, 2011 1:12 AM

Answers

  • Miha,

    I developed this program under the dotNet framework v2. Does Windows 7 Home edition support that version of the framework?

    Thanks,

    Don


    The problem lies in C++ DLL, not in managed code.

    Miha Markic [MVP C#] http://blog.rthand.com
    • Marked as answer by Paul Zhou Monday, March 7, 2011 3:25 AM
    Monday, February 28, 2011 8:36 PM
  • Hi Don,

     

    Have you resolved your problem?

    As you said, you add try-catch block in the code to access the C++ Dll without exception captured. It means there is no error to access the DLL. Your app crashes caused by the action of the DLL. Please check the function of your C++ dll.


    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Paul Zhou Monday, March 7, 2011 3:25 AM
    Friday, March 4, 2011 3:20 AM

All replies

  • Perhaps your C++ DLL accesses some functionality not provided with Win7 Home edition? Perhaps it is returning an error code (which you ignore) before it crashes?
    Miha Markic [MVP C#] http://blog.rthand.com
    Monday, February 28, 2011 9:57 AM
  • Perhaps your C++ DLL accesses some functionality not provided with Win7 Home edition? Perhaps it is returning an error code (which you ignore) before it crashes?
    Miha Markic [MVP C#] http://blog.rthand.com


    Miha,

    Thanks for this thought. I'll pursue that some more. I forgot to mention that when Windows 7 captures the AppCrash, the details consistently show a code c00005, which if I remember correctly is an operation exception.  But I hadn't considered that there might be a difference between the two Windows versions at that level.

    Monday, February 28, 2011 5:39 PM
  • Miha,

    I developed this program under the dotNet framework v2. Does Windows 7 Home edition support that version of the framework?

    Thanks,

    Don

    Monday, February 28, 2011 7:18 PM
  • Miha,

    I developed this program under the dotNet framework v2. Does Windows 7 Home edition support that version of the framework?

    Thanks,

    Don


    The problem lies in C++ DLL, not in managed code.

    Miha Markic [MVP C#] http://blog.rthand.com
    • Marked as answer by Paul Zhou Monday, March 7, 2011 3:25 AM
    Monday, February 28, 2011 8:36 PM
  • When you call C++ DLL functions they might return useful values. However that DLL might be not very well written and will simply crash no matter what you do. Hard to say without knowing more details.

    Miha Markic [MVP C#] http://blog.rthand.com
    Monday, February 28, 2011 8:37 PM
  • Hi Don,

     

    Welcome to the MSDN forum!

    Could you please descript your C++ DLL in more details? For example, what the DLL does, and how it does.

     

    Difference between Windows 7 professional and Windows 7 Home, you may post thread in Windows General Development Forum to get more useful information.


    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, March 1, 2011 8:19 AM
  • Hi Don,

     

    Have you resolved your problem?

    As you said, you add try-catch block in the code to access the C++ Dll without exception captured. It means there is no error to access the DLL. Your app crashes caused by the action of the DLL. Please check the function of your C++ dll.


    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Paul Zhou Monday, March 7, 2011 3:25 AM
    Friday, March 4, 2011 3:20 AM