Editor App problems loading Editor.dll

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Editor App problems loading Editor.dll

      I'm running the EditorApp C# program, but am getting a problem when it loads Editor.dll. Here are the details:

      1) The error occurs in EngineDisplayForm.cs, line 138, which is where it calls NativeMethods.EditorMain. Here is the entire line of code inside that file:

      NativeMethods.EditorMain(hInstance, IntPtr.Zero, hwnd, 1, this.DisplayPanel.Width, this.DisplayPanel.Height);

      The code referenced in NativeMethods is:

      const string editorDllName = "Editor.dll";
      [DllImport(editorDllName)]
      public unsafe static extern int EditorMain(IntPtr instancePtrAddress, IntPtr hPrevInstancePtrAddress, IntPtr hWndPtrAddress, int nCmdShow, int screenWidth, int screenHeight);


      2) The Editor.dll file is in the same directory as my EditorApp.exe, I build it there, and it is definitely found by the program. In fact, by executing this one line of code, Editor.dll is Loaded and then Unloaded 3 times. The output (note I've abbreviated the full path) from running this one line of code is:

      'EditorApp.exe': Loaded ...\EditorApp\Editor.dll', Symbols loaded.
      'EditorApp.exe': Unloaded ...\EditorApp\Editor.dll'
      'EditorApp.exe': Loaded ...\EditorApp\Editor.dll', Symbols loaded.
      'EditorApp.exe': Unloaded ...\EditorApp\Editor.dll'
      'EditorApp.exe': Loaded ...\EditorApp\Editor.dll', Symbols loaded.
      'EditorApp.exe': Unloaded ...\EditorApp\Editor.dll'


      3) After these 3 Loads/Unloads, it produces the following exception:

      System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)


      4) Note that I have just done a full build of Editor.dll with the latest versions of all code


      5) For my Editor project, I have specified during linking for it to have No Fixed Base Address (/FIXED:NO). When not specified I know it can present this type of problem for C# programs to link to C++ .dlls


      6) Here's the full C# build with path abbreviations. Perhaps of particular note is "'EditorApp.exe': Loaded 'ImageAtBase0x73d30000', Loading disabled by Include/Exclude setting." When I start the app, pause at a breakpoint, and open the Modules window, for this one it is the only one that says "Loading disabled by Include/Exclude setting". Note that this may be irrelelant to my current problem, I'm just theorizing. Here's the output:

      'EditorApp.exe': Loaded ...\EditorApp\EditorApp.exe', No native symbols in symbol file.
      'EditorApp.exe': Loaded 'C:\Windows\System32\ntdll.dll', Cannot find or open the PDB file
      'EditorApp.exe': Loaded ...\mscoree.dll', Cannot find or open the PDB file
      'EditorApp.exe': Loaded ...\kernel32.dll', Cannot find or open the PDB file
      'EditorApp.exe': Loaded ...\KernelBase.dll', Cannot find or open the PDB file
      'EditorApp.exe': Loaded ...\advapi32.dll', Cannot find or open the PDB file
      'EditorApp.exe': Loaded ...\msvcrt.dll', Cannot find or open the PDB file
      'EditorApp.exe': Loaded ...\sechost.dll', Cannot find or open the PDB file
      'EditorApp.exe': Loaded ...\rpcrt4.dll', Cannot find or open the PDB file
      'EditorApp.exe': Loaded ...\mscoreei.dll', Cannot find or open the PDB file
      'EditorApp.exe': Loaded ...\shlwapi.dll', Cannot find or open the PDB file
      'EditorApp.exe': Loaded ...\gdi32.dll', Cannot find or open the PDB file
      'EditorApp.exe': Loaded...\user32.dll', Cannot find or open the PDB file
      'EditorApp.exe': Loaded ...\lpk.dll', Cannot find or open the PDB file
      'EditorApp.exe': ...\usp10.dll', Cannot find or open the PDB file
      'EditorApp.exe': ...\imm32.dll', Cannot find or open the PDB file
      'EditorApp.exe': ...\msctf.dll', Cannot find or open the PDB file
      'EditorApp.exe': ...\clr.dll', Cannot find or open the PDB file
      'EditorApp.exe': ...\msvcr100_clr0400.dll', Cannot find or open the PDB file
      'EditorApp.exe': Loaded ...\mscorlib.ni.dll', Cannot find or open the PDB file
      'EditorApp.exe' (Managed (v4.0.30319)): Loaded ...\mscorlib.dll'
      'EditorApp.exe': Loaded ...\ole32.dll', Cannot find or open the PDB file
      'EditorApp.exe': Loaded ...\cryptbase.dll', Cannot find or open the PDB file
      'EditorApp.exe': Loaded ...\uxtheme.dll', Cannot find or open the PDB file
      'EditorApp.exe': Loaded ...\nlssorting.dll', Cannot find or open the PDB file
      'EditorApp.exe' (Managed (v4.0.30319)): Loaded ...\EditorApp\EditorApp.exe', Symbols loaded.
      'EditorApp.exe': Loaded ...\clrjit.dll', Cannot find or open the PDB file
      'EditorApp.exe': Loaded ...\oleaut32.dll', Cannot find or open the PDB file
      'EditorApp.exe': Loaded ...\System.ni.dll', Cannot find or open the PDB file
      'EditorApp.exe': Loaded ...\System.Drawing.ni.dll', Cannot find or open the PDB file
      'EditorApp.exe': Loaded ...\System.Windows.Forms.ni.dll', Cannot find or open the PDB file
      'EditorApp.exe' (Managed (v4.0.30319)): Loaded ...\System.Windows.Forms.dll'
      'EditorApp.exe' (Managed (v4.0.30319)): Loaded ...\System.Drawing.dll'
      'EditorApp.exe' (Managed (v4.0.30319)): Loaded ...\System.dll'
      'EditorApp.exe': Loaded ...\System.Configuration.ni.dll', Cannot find or open the PDB file
      'EditorApp.exe': Loaded ...\System.Xml.ni.dll', Cannot find or open the PDB file
      'EditorApp.exe': Loaded 'ImageAtBase0x73d30000', Loading disabled by Include/Exclude setting.
      'EditorApp.exe': Loaded 'ImageAtBase0x310000', Loading disabled by Include/Exclude setting.
      'EditorApp.exe': Unloaded 'ImageAtBase0x73d30000'
      'EditorApp.exe': Loaded ...\Microsoft.VisualStudio.Debugger.Runtime.dll', Cannot find or open the PDB file
      'EditorApp.exe': Loaded ...\Microsoft.VisualStudio.Debugger.Runtime.Impl.dll', Cannot find or open the PDB file
      'EditorApp.exe': Loaded ...\msvcr100.dll', Cannot find or open the PDB file
      'EditorApp.exe' (Managed (v4.0.30319)): ...\System.Configuration.dll'
      'EditorApp.exe' (Managed (v4.0.30319)): ...\System.Xml.dll'
      'EditorApp.exe' (Managed (v4.0.30319)):...\Microsoft.VisualStudio.Debugger.Runtime.dll'
      'EditorApp.exe': Loaded 'ImageAtBase0x52fb0000', Loading disabled by Include/Exclude setting.
      'EditorApp.exe': Unloaded 'ImageAtBase0x52fb0000'
      'EditorApp.exe': Loaded ...\comctl32.dll', Cannot find or open the PDB file
      'EditorApp.exe': Loaded ...\comctl32.dll', Cannot find or open the PDB file
      'EditorApp.exe': Loaded ...\dwmapi.dll', Cannot find or open the PDB file
      'EditorApp.exe': Loaded ...\GdiPlus.dll', Cannot find or open the PDB file

      Any help would be appreciated.
      Richard McKenna
      Lecturer
      Computer Science Department
      Stony Brook University