System.Reflection.TargetException when using Framework 1.1, Framework 2.0 and COM Interop

Posted on 2009-02-24
Last Modified: 2012-05-06
Application is a VB6 - EXE  (C.EXE) calling 2 VB .NET 2003 Framework 1.1 DLLs (A.DLL and B.DLL) via COM interoperability on Windows XP.

OK - Configuration:
All runs without problems on Windows XP, if only the .NET Framework 1.1 is installed on the computer.

It also runs on Vista When Framework 1.1 and Compact Framework 2.0 is installed.

NOT OK Configuration:
On XP, if Framework 2.0 is added to the system, during a long running function in B.DLL following exception is raised after the function has been running for a while:

"An exception 'System.Reflection.TargetException' has occurred in DefaultDomain. However, no debuggers are registered that can debug this exception. Unable to JIT debug."
During the message is shown, the VB6 applications window disappears and the application exits.

We buildt a VB.NET test driver to replace the VB6.EXE (C.EXE) to avoid using COM Interoperability. With this configuration, we did not observe the error, but that does not hel us, since we need to use the VB6 Exe.

???   Are there any Framework Updates that need to be installed  ????
<ComClass(CalcAdapter.ClassId, CalcAdapter.InterfaceId, CalcAdapter.EventsId)> _

Public Class CalcAdapter

    Public Const ClassId As String = "813A471F-FA74-433a-9254-4852347F705D"

    Public Const InterfaceId As String = "31F29B03-119F-4c8e-B699-5700EFC6C41D"

    Public Const EventsId As String = "26F047BF-CF95-4478-A431-51CF2CB9F542"

Open in new window

Question by:joachim58
    LVL 12

    Assisted Solution

    For me, do not install Framework 2.0, because of .dll conflicts.

    Framework version 2.0 has System.Reflection...

    During run time of VB6 application,  Framework version 2.0 .dll's also listen too.

    So when you run the VB6 program, VB6 call's with .dll's, and when Framework version 2.0 catchup, it also loads his own dll's.  Then conflicts occurs.

    There's no need for Framework version 2.0,  you can use Framework version 1.1 in case.  There only difference is there additional components.


    Author Comment

    The Application is a "standard-software". We do not have impact which frameworks are installed. If any user installed for example MS XML Notepad on his PC, Framework 2.0 will be there.
    Is there any possibility to avoid the problems you mentioned? Build option for the .NET assemblies is "By default, app.config supports running on .NET Framework v1.1."

    Accepted Solution

    We made up a MS support case and hope we have solved this problem with their answer:
    Use a configuration file for the (VB6-EXE) application
    for example: app-name.exe.config
    In this configuration file you can add tags to control the .NET runtime, for example to prohibit use of .NET framework 2.0

    		<requiredRuntime version="v1.1.4322"/>
    		<supportedRuntime version="v1.1.4322"/>

    Open in new window


    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Citrix XenApp, Internet Explorer 11 set to Enterprise Mode and using central hosted sites.xml file.
    Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
    This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
    With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now