Loading an extension-related mxd by double clicking it

Discussion created by arnaud31 on May 22, 2013
Hi, I am currently working in a company offering GIS solutions, and using ArcGIS tools on a daily basis. One of their main products is an ArcMap extension, which I am assigned on to correct some remaining bugs (my configuration being Windows 8 , ArcGIS 10.1 and Visual Studio 2008). One of the olders still opened (more than 2 years) is, as described by the title, the impossibility of opening a custom mxd file by double clicking it. Is was reported as not fatal, the file being loaded without the custom solvers, displaying a "naked" network, and the probleme was supposedly impossible to debug from Visual Studio.

I spent the best of three days looking for informations about it, and all I could find were the following threads:

The first was a really good kickstart to understand what happened since I wasn't aware of this way of debugging with VS, but it's a shame that the user didn't give any feedback on his progress. The second obviously wasn't helping at all. With lots of debugging and experimenting, I finally "solved" the problem using the ApplicationInitialized event, and loading the file from here with IApplication.OpenDocument if the application was launched from a double click. The idea was to let the file be loaded with the default method, and then loading it he right way by triggering our own implementation of IPersistStream.Load.

It worked fine at first, but someone found a file that fails to load in ArcMap by double clicking it, displaying the following message: [ATTACH=CONFIG]24572[/ATTACH]
The file can be loaded from ArcMap with File>Open or the initial browsing panel, is recent and not corrupted.

Since the problem is happening right after our implementation of IExtension.Startup, I tried anything I could in this method but I finally understood it isn't supposed to contain file manipulations. Then I tried to force ArcMap to always open a new file on start, but it didn't work either.

So now that I have (I hope) clearly explained the context and the problem, my question is: is it possible to load a custom extension generated mxd with our own loading method right from the start, preventing ArcMap to load it any other way ? or to force it to launch from a double clicked file as it launches from the .exe ?

I am working on this problem very hard for a week now and I can't find anything else to try, so I really hope someone here will be able to help me. I find it very strange that there is no information available on how to implement this, since it is a feature that the client expects to have and a quite useful one.