[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 517
  • Last Modified:

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

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

0
joachim58
Asked:
joachim58
  • 2
2 Solutions
 
rionrocCommented:
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.

0
 
joachim58Author Commented:
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."
0
 
joachim58Author Commented:
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

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

Open in new window

0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now