Skip to content

Commit 49c4471

Browse files
committed
Fixed issue with error message when opening VSTA. Name property not implemented, so don't call it.
1 parent 67714fb commit 49c4471

2 files changed

Lines changed: 23 additions & 2 deletions

File tree

SSIS/AutoSortProjectFilesPlugin.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ private void SolutionOpened()
6666
try
6767
{
6868
var solExplorer = ApplicationObject.ToolWindows.SolutionExplorer;
69+
6970
if (solExplorer.UIHierarchyItems.Count != 1)
7071
{
7172
return;
@@ -88,13 +89,17 @@ private void SolutionOpened()
8889
}
8990
catch (Exception ex)
9091
{
91-
MessageBox.Show(ex.ToString());
92+
ShowErrorMessageBox(ex.ToString(), "AutoSortProjectFilesPlugin.SolutionOpened");
9293
}
9394
}
9495

9596
private void ProcessHierarchyItem(UIHierarchyItem hierarchyItem)
9697
{
97-
System.Diagnostics.Debug.WriteLine(hierarchyItem.Name);
98+
if (hierarchyItem == null)
99+
return;
100+
101+
// This may be helpfull for testing, but VSTA (e.g. Script Task) will still invoke this and the Name property is not implemented, so don't leave in for release
102+
//System.Diagnostics.Debug.WriteLine(hierarchyItem.Name);
98103

99104
// Check if it is a Project, skip if not (Solution folders are a type of project too)
100105
var project = hierarchyItem.Object as Project;

core/BIDSHelperPluginBase.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,22 @@ protected Microsoft.DataWarehouse.VsIntegration.Shell.Project.Extensibility.Proj
593593
}
594594
return proj;
595595
}
596+
597+
protected void ShowErrorMessageBox(string message)
598+
{
599+
ShowErrorMessageBox(message, null);
600+
}
601+
602+
protected void ShowErrorMessageBox(string message, string captionSuffix)
603+
{
604+
string caption = DefaultMessageBoxCaption;
605+
if (string.IsNullOrEmpty(captionSuffix))
606+
{
607+
caption = string.Format("{0} - {1}", DefaultMessageBoxCaption, captionSuffix);
608+
}
609+
610+
MessageBox.Show(message, caption, MessageBoxButtons.OK, MessageBoxIcon.Error);
611+
}
596612
}
597613

598614
}

0 commit comments

Comments
 (0)