System.Runtime.InteropServices.SEHException with latest Crystal Report Runtime SP27


I'm upgrading my Crystal report runtime for visual studio from SP16 to the latest one, SP 27, but after building my whole application and running it, when I open a crystal report I end up having an error dialog showing:

Debug Assertion Failed! 
Program: C:\WINDOWS\SYSTEM32\mfc140d.dll 
File: .../mfc/occsite.cpp 

and if I click on Ignore it shows me the stack trace which is this one:

************** Exception Text **************
System.Runtime.InteropServices.SEHException (0x80004005): External component has thrown an exception.
   at COleControlSite.AttachWindow(COleControlSite* )
   at Microsoft.VisualC.MFC.CWinFormsControlSite.OnHandleCreatedHandler(CWinFormsControlSite* )
   at Microsoft.VisualC.MFC.CWinFormsControlSite.OnHandleCreated(CWinFormsControlSite* , Object A_0, EventArgs A_1)
   at Microsoft.VisualC.MFC.CWinFormsEventsHelper.OnHandleCreated(Object o, EventArgs args)
   at System.Windows.Forms.Control.OnHandleCreated(EventArgs e)
   at System.Windows.Forms.Control.WmCreate(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.UserControl.WndProc(Message& m)
   at CrystalDecisions.Windows.Forms.CrystalReportViewer.WndProc(Message& msg)
   at System.Windows.Forms.Control.ActiveXImpl.System.Windows.Forms.IWindowTarget.OnMessage(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

And then my report is being launched as normal, as if nothing happened.

I'm running VS17, VC Redistributable x64 and x86 14.25.28508, .NET Framework 4.8 and SP any from 25 to 27.

If I install any other SP from 16 to 24 they all work fine. Also on the wiki is says that VS17 is supported from SP21 and higher so I was expecting SP27 to be working fine with VS17 as well.. but it doesnt seem the case, since from SP25 it keeps throwing that exception for me

Looking at the occsite.cpp file this is the function throwing the error

void COleControlSite::AttachWindow()
    HWND hWnd = NULL;
    if (SUCCEEDED(m_pInPlaceObject->GetWindow(&hWnd)))
        ASSERT(hWnd != NULL);
        if (m_hWnd != hWnd)
            m_hWnd = hWnd;

            if (m_pWndCtrl != NULL)
                ASSERT(m_pWndCtrl->m_hWnd == NULL); // Window already attached?

                ASSERT(m_pWndCtrl->m_pCtrlSite == NULL ||
                    m_pWndCtrl->m_pCtrlSite == this);
                m_pWndCtrl->m_pCtrlSite = this;
asked on Stack Overflow May 13, 2020 by user3675510 • edited May 13, 2020 by user3675510

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0