Skip to content

Commit

Permalink
Issue 41/active document error (#44)
Browse files Browse the repository at this point in the history
* Retrieving the active document is now wrapped in a try-catch

This was done on a pure hunch based on e.g. the discussion on fsprojects-archive/zzarchive-VisualFSharpPowerTools#653, as the bug isn't currently reproducible.

#41

* Version bumped

#41

* Updated version info

#41
  • Loading branch information
uli-weltersbach authored Aug 28, 2019
1 parent e1d69f7 commit ebf9fdd
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
[assembly: AssemblyCompany("Reason→Code→Example (http://reasoncodeexample.com)")]
[assembly: AssemblyProduct("ReasonCodeExample.XPathTools.Tests")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("6.0.2.*")]
[assembly: AssemblyVersion("6.0.3.*")]
12 changes: 10 additions & 2 deletions ReasonCodeExample.XPathTools/ActiveDocument.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,16 @@ public virtual Document Current
get
{
ThreadHelper.ThrowIfNotOnUIThread();
var dte = (DTE)Package.GetGlobalService(typeof(DTE));
return dte?.ActiveDocument;
try
{
var dte = (DTE)Package.GetGlobalService(typeof(DTE));
return dte?.ActiveDocument;
}
catch(Exception ex)
{
Console.Error.WriteLine($"Error retrieving '{nameof(DTE.ActiveDocument)}': {ex}");
return null;
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion ReasonCodeExample.XPathTools/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[assembly: AssemblyCompany("Reason→Code→Example (http://reasoncodeexample.com)")]
[assembly: AssemblyProduct("ReasonCodeExample.XPathTools")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("6.0.2.*")]
[assembly: AssemblyVersion("6.0.3.*")]
[assembly: InternalsVisibleTo(InternalsVisibleTo.ReasonCodeExampleXPathToolsTests)]
[assembly: InternalsVisibleTo(InternalsVisibleTo.DynamicProxyGenAssembly2)]
[assembly: InternalsVisibleTo(InternalsVisibleTo.CastleCore)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="ReasonCodeExample.XPathInformation.v1.0" Version="6.0.2" Language="en-US" Publisher="Uli Weltersbach" />
<Identity Id="ReasonCodeExample.XPathInformation.v1.0" Version="6.0.3" Language="en-US" Publisher="Uli Weltersbach" />
<DisplayName>XPath Tools</DisplayName>
<Description xml:space="preserve">Run XPaths and XPath functions. Browse through results at the click of a button.
Track and copy XPaths incl. XML namespaces in various formats, taking the hassle out of complex documents.</Description>
Expand Down
3 changes: 2 additions & 1 deletion ReasonCodeExample.XPathTools/release-notes.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
v6.0.2: The XPath format used in the statusbar is now persisted correctly. See issue #42 for details (https://github.com/uli-weltersbach/XPathTools/issues/42).
v6.0.3: Gracefully handle exceptions seemingly caused by accessing the currently active document via the "Edit Project File" VS2019 contet menu entry. See issue #41 for details (https://github.com/uli-weltersbach/XPathTools/issues/41).
v6.0.2: The XPath format used in the statusbar is now persisted correctly. See issue #42 for details (https://github.com/uli-weltersbach/XPathTools/issues/42).
v6.0.1: XPath Runner query results now change focus to their source document when clicked. See issue #38 for details (https://github.com/uli-weltersbach/XPathTools/issues/38).
v6.0.0: Async package load implemented as required by Visual Studio 2019.1 and later. Support for Visual Studio 2013 and earlier has been dropped as a consequence.
v5.3.0: Supported Visual Studio version range updated to include VS 2019 Preview. See issue #36 for details (https://github.com/uli-weltersbach/XPathTools/issues/36).
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '6.0.2-{build}'
version: '6.0.3-{build}'
image: Visual Studio 2017
configuration: Release
platform: Any CPU
Expand Down

0 comments on commit ebf9fdd

Please sign in to comment.