Microsoft KB Archive/888325

= BUG: You may receive a &quot;COMException (0x80010105): The server threw an exception&quot; error message in Visual Studio .NET 2003 =

Article ID: 888325

Article Last Modified on 5/20/2005

-

APPLIES TO


 * Microsoft Visual Studio .NET 2003 Enterprise Architect
 * Microsoft Visual Studio .NET 2003 Enterprise Developer
 * Microsoft Visual Studio .NET 2003 Academic Edition

-





SYMPTOMS
In Microsoft Visual Studio .NET 2003, if you automate your application to run out-of-process, you may receive a COM exception error message that is similar to the following from the Devenv.exe out-of-process component:

Unhandled Exception: System.ApplicationException: Failed ---> System.Runtime.Int

eropServices.COMException (0x80010105): The server threw an exception. at EnvDTE._Solution.Open(String FileName) at DTEAutomation.Class1.Main(String[] args) in c:\vs7play\enterprisetemplate\ dteautomation\class1.cs:line 45

--- End of inner exception stack trace --- at DTEAutomation.Class1.Main(String[] args) in c:\vs7play\enterprisetemplate\ dteautomation\class1.cs:line 80



CAUSE
This problem occurs because a cached pointer to the selected data is not valid. Then, the Enterprise Template Project is opened.



WORKAROUND
To work around this problem, use one of the following methods.

Method 1
Open the MainWindow property as visible before you open the Enterprise Template Project. To do this, add the following code example before the solution.Open statement in your code. solution.DTE.MainWindow.Activate;

Method 2
Hide the Solution Explorer window before you open the Enterprise Template Project. To do this, change the solution.Open statement to look similar to the following code example. Window w = cls.DTE.Windows.Item(Constants.vsWindowKindSolutionExplorer); w.Visible=false;

solution.Open(solutionFileName); w.Visible=true;



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the &quot;Applies to&quot; section.



Call stack information
When this problem occurs, you may notice a call stack that is similar to the following: msenv!CVsUIHierarchyBaseWin::UpdateSelCtx+0xfa msenv!CWinSelection::SelectItem+0x73 msenv!CVsUIHierarchyBaseWin::ExpandItem+0x19a msats10!CHierNode::ExtExpand+0xc8 msats10!TSBaseFileViewNode::AddVirtualProjectWrapper+0x4d msats10!TSBaseFileViewNode::AddVirtualProjectWrapper+0x93 msats10!TSProject::OpenChildren+0xce msenv!CSolution::Open+0xdae msenv!CVSolution::Open+0xa2

Steps to reproduce the problem
 Start Visual Studio .NET 2003. Click File, point to New, and then click Project. In the New Project dialog box, click Other Projects, click Enterprise Template Projects, and then click Visual Basic Simple Distributed Application. Close the solution. Click File, point to New, and then click Project.</li> In the New Project dialog box, click Visual C# Projects, and then click Windows Application.</li>  Add the following code to the Microsoft Windows Application project that you created in step 6.

Note Replace the  string with the path of the solution that you created in step 3. [STAThread] static void Main(string[] args) {           const string DEFAULT_VISUAL_STUDIO_PROGID = &quot;VisualStudio.Solution.7.1&quot;;

string progID = DEFAULT_VISUAL_STUDIO_PROGID;

Solution solution; try {                  Type t = Type.GetTypeFromProgID(progID); object obj = Activator.CreateInstance(t, true); Solution cls = (Solution)obj; string solutionFileName = @&quot;C:\vs7play\enterprisetemplate\Project3\Project3.sln&quot;; solution = cls; solution.Open(solutionFileName); } }           catch(Exception ex) {               throw new ApplicationException(String.Format(&quot;Failed&quot;, progID), ex); }       } </li> Run the console application.</li></ol>

You receive the error message that is mentioned in the &quot;Symptoms&quot; section.

Keywords: kbtshoot kbbug kbprogramming kbcompiler KB888325

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.