473,383 Members | 1,725 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,383 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 2893

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: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.