1

嗨,提前感谢您花时间阅读本文。

我在 VS2010 中调试我的解决方案时遇到问题。更具体地说,这是设置:

  • 一切都是为 Windows 7、64 位编码的
  • 第 3 方 EXE (c++) 通过 c# 公开其 api
  • 我的插件 (c#) 调用了混合模式 dll
  • 混合模式 dll 调用本机 c++
  • 本机 c++ dll 调用了许多已经为其他程序编写的生产代码(也是本机 c++)
  • 本机 c++ dll 还调用另一个混合模式 dll,然后调用 ac# dll
  • 在 VS2010 中编写和编译的所有内容

这是奇怪的事情:

  • 当我调试我的托管代码时,一切正常;没有例外
  • 当我调试我的本机代码时,我得到随机异常 (0xe0434352),就在 c++ 调用混合模式 dll 时(这实际上只是 c# dll 中代码的接口)
  • 当弹出异常窗口(第一次机会)时,我点击跳过/继续,但无法进一步调试;程序执行结果是一样的
  • 如果我注释掉对混合模式代码的调用,问题就会消失

编辑:

发布生产代码有点敏感。例外只是我上面提到的通用例外。异常窗口字面意思是:

  • Revit.exe 中发生异常(第一次机会):0xe0434352:0xe0434352。
  • 这是 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 字节 C++ RevitClient.dll!RvtToMyProg::addElementAttributes(int Sel=0, const CadElem & CadElem={...}, DigitalModelMapping & DigiModMap={...}, const Descriptor * EntDesc=0x000000003ace72b0, Entity * XDataEnt=0x0000000056ad70a0) Zeile 630 + 0x75 字节 C++ RevitClient.dll!RvtToMyProg::dataToMyProg(DigitalModelMapping & DigiModMap={...}, std:: set > >,std::less > > >,std::allocator > > > > & Classnames=3, Descriptor & ModDsc={...}, XDataModel & XData={...}) Zeile 575 + 0x46 字节 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()
000007FE87FE87D0D81B() 000007FE89892B1A (
) 000007FE87FE87D0D0D2E6 ( ) 000007FEE87FE87FE87FEE87DECA76()






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 字节(C++ mfc100u.dll:HCWND__WalkPreTranslate.dll: 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() ()
kernel32.dll!00000000777f652d()
ntdll.dll!0000000077a2c521()

  • 也许一些示例代码:

    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);
    }
    

我很高兴有任何建议可以为我指明正确的方向。

谢谢, 科尔内尔

4

0 回答 0