Skip to content

Commit

Permalink
Fixed opening non-project files
Browse files Browse the repository at this point in the history
When files that weren't part of a project (added directly to a solution or open as a raw file outside the solution) were selected in the file list, a Not Implemented exception window was thrown up and VS would crash if the file was selected a second time. This catches the exception and attempts to open the file by path instead of by file reference.

Fixes #6
  • Loading branch information
parnic committed May 15, 2019
1 parent 1ac21e9 commit 3b92ae2
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions ListFiles.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
Expand Down Expand Up @@ -126,8 +127,16 @@ private void OpenSelectedFiles(bool bInSolutionExplorer)
{
if (!bInSolutionExplorer)
{
var w = (item as ProjectItemWrapper).ProjItem.Open();
w.Visible = true;
try
{
var w = (item as ProjectItemWrapper).ProjItem.Open("{7651A703-06E5-11D1-8EBD-00A0C90F26EA}");
w.Visible = true;
}
catch (Exception)
{
var w = OpenFileInSolutionPackage.GetActiveIDE().ItemOperations.OpenFile((item as ProjectItemWrapper).Path);
w.Visible = true;
}
}
else
{
Expand Down

0 comments on commit 3b92ae2

Please sign in to comment.