none
Garbage collector causes Excel to crash RRS feed

  • Question

  • Hi,

    I have an application designed to target .NET 4.0. The application registers some classes to COM.

    I use these classes from Excel VBA.

    When I throw a COMException from the application, Excel crashes, pointing to clr.dll (APPCRASH).

    Now, in versions 4.0 and 4.5 everything works fine, I throw the exception, the error handler handles it and presents to the user in a message box. However, in 4.5.1 and 4.5.2, Excel would crash.

    It is both Excel 2010 and 2013, and I have Windows 7 x64-bit installed, while the application itself s 32-bit.

    Thanks in advance!

    Tuesday, June 9, 2015 11:42 AM

All replies

  • Hello Gavrilo Mumovic,

    From your provided description, it could be that the new Framework is not be compatible with the COM.

    >>When I throw a COMException from the application, Excel crashes, pointing to clr.dll (APPCRASH).

    If possible, please share code that throws the COM exception from your .NET application and the VBA code you call this COM interop in your excel. Also, if there is a detail information about the crash, please share it with us.

    >>It is both Excel 2010 and 2013, and I have Windows 7 x64-bit installed, while the application itself s 32-bit.

    Have you tried to run it on a other system version as win8/8.1? I suggest you do that which could help narrow down this issue.

    Regards.


    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.

    Wednesday, June 10, 2015 1:45 AM
    Moderator
  • Sounds similar to this post. Note the Hotfix KB at the end.

    https://social.msdn.microsoft.com/Forums/en-US/c5138512-2e63-48ee-b93d-523e98aa6955/systemruntimeinteropservicescomexception-cant-be-handled-by-com-client-after-net-45-is?forum=clr

    Though you say 4.5 works for you, which doesn't match the post or KB.

    Thursday, June 11, 2015 1:30 AM
  • Hi,

    Thanks for the reply.

    Basically, I'm the one creating COMException when I want to signal to the user that something is wrong, or the calculation could not converge, so

    throw new COMException(message, number);

    The code in VBA looks something like this

    Dim myInput as MyInput
    Set myInput = new MyInput
    
    Dim myOutput as MyOutput
    Set myOutput = new MyOutput
    
    Dim myCalculation as MyCalculation
    Set myCalculation = new MyCalculation
    
    Call myCalculation.Run(myInput, myOutput)

    So, the calculations can't converge, and I throw a COMException that the user should handle.

    I have tried on 8.1 64-bit, and it works just fine, no crash.

    Tuesday, June 16, 2015 2:48 PM
  • Hello Gavrilo Mumovic,

    >>I have tried on 8.1 64-bit, and it works just fine, no crash.

    You mean with windows 8.1 64 bit and .NET Fraemwork 4.5.1/4.5.2, the exception would handled at your Excel side. If so, I suggest you could post a feedback about this scenario to team:

    https://connect.microsoft.com/VisualStudio

    Regards.


    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.

    Wednesday, June 17, 2015 6:00 AM
    Moderator
  • Thanks for help. 

    It is windows 8.1 64 bit with .NET Framework 4.5.1 (but there's a difference in .NET version 4.5.1 for Windows 8.1 and Win 7)

    I'll create a bug on the site you suggested.

    Thanks!

    Wednesday, June 17, 2015 11:41 AM