Hi and thanks in advance for your time reading this.
I've got a problem debugging my solution in VS2010. To be more specific, here's the setup:
- everything is coded for Windows 7, 64bit
- the 3rd party EXE (c++) exposes its api over c#
- my plugin (c#) calls into a mixed mode dll
- mixed mode dll calls native c++
- native c++ dll calls a lot of production code already written for other programs (also native c++)
- native c++ dll also calls another mixed mode dll which then calls a c# dll
- everything written and compiled in VS2010
Here's the odd thing:
- when I debug my managed code everything works fine; no exceptions
- when I debug my native code I get random exceptions (0xe0434352) just when c++ calls into the mixed mode dll (which really just is an interface for the code in the c# dll)
- when the exception window (first chance) pops up I hit skip/continue but no further debugging is possible; program execution results are the same though
- the problem disappears if I comment out the call to the mixed mode code
EDIT:
Posting production code is a bit sensitive. The Exception is just the generic one I mentioned above. The exception window literally says:
- An Exception (first chance) occurred at in Revit.exe: 0xe0434352: 0xe0434352.
- It's Revit MEP 2013
KernelBase.dll!000007fefd8f9e5d()
[Unten angegebene Rahmen sind möglicherweise nicht korrekt und/oder fehlen, keine Symbole geladen für KernelBase.dll]
clr.dll!000007fee65c4e13()
clr.dll!000007fee65c597e()
000007fe898bad42()
000007fe898b65be()
000007fe898b646b()
000007fe898b6144()
000007fe898b5fa3()
000007fe898b5d4b()
clr.dll!000007fee644f2ee()
RevitClient.dll!RvtToMyProg::getPropMappedValue(std::basic_string,std::allocator > & Res="", int Sel=0, DigitalModelMapping & DigiModMap={...}, const CadElem & Elem={...}, std::basic_string,std::allocator > & Prop="NAME") Zeile 721 + 0x8d Bytes C++ RevitClient.dll!RvtToMyProg::addElementAttributes(int Sel=0, const CadElem & CadElem={...}, DigitalModelMapping & DigiModMap={...}, const Descriptor * EntDesc=0x000000003ace72b0, Entity * XDataEnt=0x0000000056ad70a0) Zeile 630 + 0x75 Bytes C++ RevitClient.dll!RvtToMyProg::dataToMyProg(DigitalModelMapping & DigiModMap={...}, std::set > >,std::less > > >,std::allocator > > > > & Classnames=3, Descriptor & ModDsc={...}, XDataModel & XData={...}) Zeile 575 + 0x46 Bytes C++ 000007fe898a7aa3()
000007fe898a79eb()
000007fe898a7837()
000007fe898a5aef()
000007fe898a5624()
clr.dll!000007fee644f2ee()
RevitAPIUILink.dll!0000000033c31bfb()
RevitAPIUILink.dll!0000000033c326d8()
DesktopMFC.dll!00000000007e1843()
000007fe898a471e()
000007fe898a044f()
000007fe8989ff7b()
000007fe8989fc3e()
000007fe89892e9d()
000007fe89892d33()
000007fe87d0da2a()
000007fe87d0d81b()
000007fe89892b1a()
000007fe87d0d2e6()
000007fe87d0ca76()
000007fe87d0955a()
000007fe89892880()
000007fe898925c9()
000007fe8989f382()
000007fe89852427()
000007fe87d0d2e6()
000007fe87d0ca76()
000007fe898439be()
000007fe87d0d2e6()
000007fe87d0ca76()
000007fe87d0955a()
000007fe896da930()
000007fe8943dbb8()
000007fe8943cbcb()
000007fe8943c84f()
000007fe896d3520()
000007fe8796a6d8()
000007fe8796a261()
000007fe873b09ae()
000007fe873b087c()
000007fe873b06f5()
000007fe873b0507()
000007fe873afee7()
000007fe873acd2e()
000007fe873ac383()
clr.dll!000007fee644f2ee()
user32.dll!0000000077919bd1()
user32.dll!00000000779198da()
user32.dll!00000000779167c2()
mfc100u.dll!CWnd::IsDialogMessageW(tagMSG * lpMsg=0x0000000000000202) Zeile 198 C++ mfc100u.dll!CControlBar::PreTranslateMessage(tagMSG * pMsg=0x000000900abd6714) Zeile 445 + 0x2c Bytes C++ mfc100u.dll!CWnd::WalkPreTranslateTree(HWND__ * hWndStop=0x000000000922e8a0, tagMSG * pMsg=0x0000000000000002) Zeile 3311 + 0x10 Bytes C++ mfc100u.dll!AfxInternalPreTranslateMessage(tagMSG * pMsg=0x0000000140003070) Zeile 233 + 0x15 Bytes C++ mfc100u.dll!AfxInternalPumpMessage() Zeile 178 + 0x12 Bytes C++ mfc100u.dll!CWinThread::Run() Zeile 634 C++ mfc100u.dll!AfxWinMain(HINSTANCE__ * hInstance=0x0000000000000001, HINSTANCE__ * hPrevInstance=0x0000000000000000, wchar_t * lpCmdLine=0x0000000000000000, int nCmdShow=0) Zeile 47 + 0xd Bytes C++ Revit.exe!00000001400011d6()
kernel32.dll!00000000777f652d()
ntdll.dll!0000000077a2c521()
maybe some sample code:
c++: dostuff() { //it = std::list::iterator std::string = this->MixedMode->GetElementPropertyValue(Sel, it->Name, it->Api); } mixed mode: std::string RevitBridge::GetElementPropertyValue(int Sel, const std::string &Name, const std::string &ApiName) { String^ sName = gcnew String(Name.c_str()); String^ sApiName = gcnew String(ApiName.c_str()); String^ s = RevitUtils::GetElementPropertyValue(Sel, sName, sApiName); return std::string(msclr::interop::marshal_as<std::string>(s)); } c#: public String GetElementPropertyValue(int Sel, String Name, String ApiName) { if (Sel < 0) { return ""; } if (Name.Equals("_ElementID_")) { return this.GetElementID(Sel); } BuiltInParameter bip = BuiltInParameter.INVALID; try { bip = (BuiltInParameter)Enum.Parse(typeof(BuiltInParameter), ApiName); } catch (Exception) {} if (ApiName.Equals("INVALID") || BuiltInParameter.INVALID == bip) { return this.GetElemParamValueAsString_ByName(iters[Sel].Current, Name); } return this.GetElemParamValueAsString(iters[Sel].Current, bip); }
I'd be glad for any kind of advice pointing me in the right direction.
Thanks, Kornel