473,238 Members | 1,851 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,238 software developers and data experts.

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 2854

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: kaalus | last post by:
Hello I have problem mixing managed and unmanaged C++ code in VS.NET 2003. I want to create a windows forms application which uses some C++ code that is incompatible with managed extensions...
2
by: Neil | last post by:
I am developing a demo in C# using Managed DirectX. I wanted to use a C++ static library in the demo (its a class for handling physics), so I decided to create my Graphics classes in C#, inherit...
0
by: P Reddy | last post by:
Hi All, Greetings!!! I have a question. Please respond.... I am trying to write a C# component that need to inherit some of the the interfaces from unmanged code(VC). I think one way to...
2
by: MR | last post by:
help! I have an unmanaged DLL that I do not have the source code, so i can't recompile or make changes. the DLL requires a callback function. I would like to implement the callback method in a...
1
by: al | last post by:
Hi, I'm very confused about the following: Can someone please explain the difference between Type and Strong Typed Data and if there is untyped data in the Managed Code, and how this relates to...
4
by: gabe | last post by:
i have a solution to gather the text in each window that is open, but would rather use only managed code rather than unmanaged code my current solution relies on. The purpose is to get the text in...
2
by: jraul | last post by:
Hi, This is probably a noobie question but: I just created a new C++/CLI project in VS 2005. It created an empty class: public ref class Class1 { // TODO: Add your methods for this class...
2
by: Cartoper | last post by:
I am working in VS2005 (.Net 2.0). I have a unmanaged C++ class that will be used by C#, once I get to that point. I would like to throw a System::ApplicationException from the unmanaged code,...
2
by: Jon Slaughter | last post by:
How difficult is it for one to integrate unmanaged C++ into C#? I know for functions one can use DLLimport but how does one go about doing it for classes? Do I have to completely reimplement the...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.