3

Here is my dilemma:

The Problem

  1. I have SubProgram (a DLL) that uses System.Data.SQLite and both are compiled to .NET 2.0
  2. My MainProgram (an EXE) is compiled to .NET 4.0
  3. My MainProgram loads SubProgram into a separate app domain and communicates with a proxy

Apparently, MainProgram is loading SubProgram and running it with .NET 4.0. This causes a known issue with System.Data.SQLite.

Now, I have researched and tried all the suggested fixes for the SQLite issue and the only one that worked was updating to the System.Data.SQLite assembly compiled using .NET 4.0 (see .NET 4.0 version at this link).

This would solve my issue only we have a strict set of rules for releasing and are not releasing SubProgram or it's dependencies in any way, therefore the System.Data.SQLite DLL that SubProgram is using must stay as the current .NET 2.0 version.

Question(s)

  1. Is there a way to specify that MainProgram load and run SubProgram using .NET 2.0? Maybe something when setting up the app domain? So far I cannot find anything.

  2. Is there another solution?

Community
  • 1
  • 1
Mike Webb
  • 8,855
  • 18
  • 78
  • 111
  • 1
    No, that's only possible in custom hosting scenarios. You probably wouldn't be ahead by making it [ComVisible]. Talk to the Man That Makes The Rules, we can't help you with that. – Hans Passant Nov 04 '11 at 20:46

1 Answers1

2

The only way you'll be able to do this is using cross-process communication rather than cross-AppDomain.

All AppDomains for a given application still run within the same process, therefore have to run within the same root CLR context (and same .NET runtime). But the .NET Remoting tech that would normally provide proxy communication and marshalling across AppDomain boundaries is also applicable with few modifications to cross-process communication.

If you change SubProgram to be a separate process, and add a Remoting channel between the two, this should be a reasonable way forward given your other constraints around releasing.

Alex Norcliffe
  • 2,439
  • 2
  • 17
  • 21