469,268 Members | 975 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,268 developers. It's quick & easy.

Mixing manged and unmanaged code with DLL leads to HRExeception at start

Hello,

I'm new to the realm of .NET application creation, so please forgive
my ignorance.

I have been tasked with debugging a problem that arises with using a
DLL that contains managed and unmanaged code in concert with a managed
application that makes calls to the DLL. This problem has been
cropping up for a while, but the debugger provides very little
information (from what I can tell) as to what exactly is the problem.

During application load, I get a dialog before getting into main:

First-chance exception at 0x7c812a5b in FormatConvertord.exe:
Microsoft C++ exception: HRException at memory location 0x0012e74c..

The break shows up here:

mcrtexe.cpp:323
if defined (_MANAGED_MAIN)
__set_managed_app_type();
mainret = main(arguments);
#else /* defined (_MANAGED_MAIN) */

If I ignore, I get a couple more dialogs with worsening messages
before the application quits:

First-chance exception at 0x7c812a5b in FormatConvertord.exe:
Microsoft C++ exception: [rethrow] at memory location 0x00000000..

First-chance exception at 0x7c98eafa in FormatConvertord.exe:
0xC0000025: Windows cannot continue from this exception.

A first chance exception of type
'System.Runtime.InteropServices.SEHException' occurred in
FormatConvertord.exe Additional information: External component has
thrown an exception.

I scoured Google for similar text, but only found a handful of
articles with the same text as mine. I have _no idea_ a) what type of
exeception this is
b) where exaclty in the code this is being triggered (as it's before
main, and the call stack doesn't have a lot of places to break into)
c) how to debug this and find out what's causing the problem.

I know this is vague, but I'm guessing it has something to do with
adding the DLL into my managed application, and not setting up
something correctly in the manifest/dependencies/build settings??

I'm really out on a limb, and would be grateful for any insight anyone
has. Also, please forgive if this is the not the best newsgroup for
this type of problem. If so, I'd be much obliged if someone could
point me to a better newsgroup.

Thanks!!

Here is the console text:

'FormatConvertord.exe': Loaded 'D:\Bin\FormatConvertord.exe', Symbols
loaded.
'FormatConvertord.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll', No
symbols loaded.
'FormatConvertord.exe': Loaded 'C:\WINDOWS\system32\mscoree.dll', No
symbols loaded.
'FormatConvertord.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll', No
symbols loaded.
'FormatConvertord.exe': Loaded 'C:\WINDOWS\system32\advapi32.dll', No
symbols loaded.
'FormatConvertord.exe': Loaded 'C:\WINDOWS\system32\rpcrt4.dll', No
symbols loaded.
'FormatConvertord.exe': Loaded 'C:\WINDOWS\WinSxS
\x86_Microsoft.VC80.DebugCRT_1fc8b3b9a1e18e3b_8.0. 50727.762_x-
ww_5490cd9f\msvcr80d.dll', Symbols loaded.
'FormatConvertord.exe': Loaded 'C:\WINDOWS\system32\msvcrt.dll', No
symbols loaded.
'FormatConvertord.exe': Loaded 'C:\WINDOWS\WinSxS
\x86_Microsoft.VC80.DebugCRT_1fc8b3b9a1e18e3b_8.0. 50727.762_x-
ww_5490cd9f\msvcp80d.dll', Symbols loaded.
'FormatConvertord.exe': Loaded 'C:\WINDOWS\system32\user32.dll', No
symbols loaded.
'FormatConvertord.exe': Loaded 'C:\WINDOWS\system32\gdi32.dll', No
symbols loaded.
'FormatConvertord.exe': Loaded 'C:\WINDOWS\system32\ole32.dll', No
symbols loaded.
'FormatConvertord.exe': Loaded 'C:\WINDOWS\system32\shlwapi.dll', No
symbols loaded.
'FormatConvertord.exe': Loaded 'C:\WINDOWS\system32\d3d9.dll', No
symbols loaded.
'FormatConvertord.exe': Loaded 'C:\WINDOWS\system32\d3d8thk.dll', No
symbols loaded.
'FormatConvertord.exe': Loaded 'C:\WINDOWS\system32\version.dll', No
symbols loaded.
'FormatConvertord.exe': Loaded 'C:\WINDOWS\system32\winmm.dll', No
symbols loaded.
'FormatConvertord.exe': Loaded 'C:\WINDOWS\system32\d3dx9_33.dll', No
symbols loaded.
'FormatConvertord.exe': Loaded 'C:\WINDOWS\system32\comdlg32.dll', No
symbols loaded.
'FormatConvertord.exe': Loaded 'C:\WINDOWS\system32\comctl32.dll', No
symbols loaded.
'FormatConvertord.exe': Loaded 'C:\WINDOWS\system32\shell32.dll', No
symbols loaded.
'FormatConvertord.exe': Loaded 'C:\WINDOWS\WinSxS
\x86_Microsoft.VC80.DebugCRT_1fc8b3b9a1e18e3b_8.0. 50727.762_x-
ww_5490cd9f\msvcm80d.dll', Symbols loaded.
'FormatConvertord.exe': Loaded 'C:\WINDOWS\system32\imm32.dll', No
symbols loaded.
'FormatConvertord.exe': Loaded 'C:\WINDOWS\system32\lpk.dll', No
symbols loaded.
'FormatConvertord.exe': Loaded 'C:\WINDOWS\system32\usp10.dll', No
symbols loaded.
'FormatConvertord.exe': Loaded 'C:\WINDOWS\WinSxS
\x86_Microsoft.Windows.Common-
Controls_6595b64144ccf1df_6.0.2600.2982_x-ww_ac3f9c03\comctl32.dll',
No symbols loaded.
'FormatConvertord.exe': Loaded 'C:\WINDOWS\Microsoft.NET\Framework
\v2.0.50727\mscorwks.dll', No symbols loaded.
'FormatConvertord.exe': Loaded 'C:\WINDOWS\WinSxS
\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727 .762_x-
ww_6b128700\msvcr80.dll', Symbols loaded.
'FormatConvertord.exe': Loaded 'C:\WINDOWS\Microsoft.NET\Framework
\v2.0.50727\Culture.dll', No symbols loaded.
'FormatConvertord.exe': Unloaded 'C:\WINDOWS\Microsoft.NET\Framework
\v2.0.50727\Culture.dll'
'FormatConvertord.exe': Loaded 'C:\WINDOWS\assembly
\NativeImages_v2.0.50727_32\mscorlib\31bae18808fa8 d45ad26959f0c9bfd5f
\mscorlib.ni.dll', No symbols loaded.
'FormatConvertord.exe' (Managed): Loaded 'C:\WINDOWS\assembly
\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorli b.dll', No symbols
loaded.
'FormatConvertord.exe' (Managed): Loaded 'd:\p4_dc01666_UZURA\Program
\Suite102\Bin\FormatConvertord.exe', Symbols loaded.
'FormatConvertord.exe': Loaded 'C:\WINDOWS\Microsoft.NET\Framework
\v2.0.50727\mscorjit.dll', No symbols loaded.
'FormatConvertord.exe': Loaded 'C:\WINDOWS\Microsoft.NET\Framework
\v2.0.50727\diasymreader.dll', No symbols loaded.
'FormatConvertord.exe': Loaded 'C:\WINDOWS\system32\rsaenh.dll', No
symbols loaded.
'FormatConvertord.exe' (Managed): Loaded 'C:\WINDOWS\WinSxS
\x86_Microsoft.VC80.DebugCRT_1fc8b3b9a1e18e3b_8.0. 50727.762_x-
ww_5490cd9f\msvcm80d.dll', Symbols loaded.
'FormatConvertord.exe': Loaded 'C:\WINDOWS\assembly
\NativeImages_v2.0.50727_32\System
\c78e3732b9073946b6f8e816d9b1ac85\System.ni.dll', No symbols loaded.
'FormatConvertord.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL
\System\2.0.0.0__b77a5c561934e089\System.dll', No symbols loaded.
'FormatConvertord.exe': Loaded 'D:\Bin\FormatConvertorDllDebug.dll',
Symbols loaded.
'FormatConvertord.exe': Unloaded 'D:\Bin\FormatConvertorDllDebug.dll'
First-chance exception at 0x7c812a5b in FormatConvertord.exe:
Microsoft C++ exception: HRException at memory location 0x0012e74c..
C:\WINDOWS\system32\d3dx9_33.dll: No symbols loaded.
C:\WINDOWS\system32\d3dx9_33.dll: No symbols loaded.
C:\WINDOWS\system32\d3dx9_33.dll: No symbols loaded.
First-chance exception at 0x7c812a5b in FormatConvertord.exe:
Microsoft C++ exception: [rethrow] at memory location 0x00000000..
First-chance exception at 0x7c98eafa in FormatConvertord.exe:
0xC0000025: Windows cannot continue from this exception.
First-chance exception at 0x7c98eafa in FormatConvertord.exe:
0xC0000025: Windows cannot continue from this exception.
First-chance exception at 0x7c98eafa in FormatConvertord.exe:
0xC0000025: Windows cannot continue from this exception.
A first chance exception of type
'System.Runtime.InteropServices.SEHException' occurred in
FormatConvertord.exe

Additional information: External component has thrown an exception.

An unhandled exception of type
'System.Runtime.InteropServices.SEHException' occurred in
FormatConvertord.exe

Additional information: External component has thrown an exception.

The thread 'Win32 Thread' (0xc7c) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0x968) has exited with code 0 (0x0).
The program '[3788] FormatConvertord.exe: Managed' has exited with
code 0 (0x0).
The program '[3788] FormatConvertord.exe: Native' has exited with code
0 (0x0).

<< cross-posted to dotnet.framework, sorry >>

May 30 '07 #1
0 2587

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by kaalus | last post: by
1 post views Thread by al | last post: by
2 posts views Thread by jraul | last post: by
2 posts views Thread by Jon Slaughter | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.