Question

I'm working on a Compact Framework 2.0 project, and I'm trying to launch a program "B" from within another program "A" using Process.Start. I've done this several times before, but I'm running into some weird issues this time.

Program "B" does launch, but it causes a MissingMethodException, basically telling me that it is missing a certain assembly that it has referenced. The problem is that the assembly .dll is right there, in the same folder as program "B". If I double-click on program "B", it runs correctly with no MissingMethodException, it is only when launched with Process.Start in program "A" that this problem occurs. I've absolutely no clue what is going on here. I tried setting the WorkingDirectory property with no luck. Any ideas as to why the program can't load its references when executed through Process.Start? Thanks

System.Diagnostics.Process proc = new System.Diagnostics.Process();
            ProcessStartInfo startInfo = new ProcessStartInfo(programBFullPath, "argument");

            //I've been changing these two properties, have tried shell execute with both false and true, tried setting working directory and not setting it also
            startInfo.UseShellExecute = false;
            startInfo.WorkingDirectory = programBDirectory;

            proc.StartInfo = startInfo;
            proc.Start();

EDIT I just thought of something... Both program "A" and program "B" use the .dll that program "B" is not loading. If two programs can't load the same .dll at the same time then that is the issue. Is this the case?

Was it helpful?

Solution 2

Well I made it work by duplicating the referenced code on program B's assembly and removing all references. It is far from elegant, but I couldn't get it to work any other way. If anyone has any idea of what might have gone wrong I would greatly appreciate it. It might come in handy some other time. Thanks

OTHER TIPS

How does memory pressure look on the device? If Program B relies on Assembly C, but there is insufficient memory (virtual or physical) to load assembly C, then you'll get a MissingMethodException (instead of an OutOfMemoryException, which I always thought would make more sense).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top