Skip to content

Commit

Permalink
Report environment in execption report
Browse files Browse the repository at this point in the history
  • Loading branch information
lzybkr committed Oct 3, 2018
1 parent df2ad36 commit 57bc3a6
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 22 deletions.
18 changes: 12 additions & 6 deletions PSReadLine/PSReadLineResources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 18 additions & 15 deletions PSReadLine/PSReadLineResources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -393,17 +393,20 @@ Oops, something went wrong. Please report this bug with the details below.
Report on GitHub: https://github.com/lzybkr/PSReadLine/issues/new</value>
</data>
<data name="OopsAnErrorMessage2" xml:space="preserve">
<value>-----------------------------------------------------------------------
Last {0} Keys:
<value>### Environment
PSReadLine: {0}
PowerShell: {1}
OS: {2}
Last {3} Keys
```
{1}
{4}
```

Exception:
### Exception
```
{2}
{5}
```
-----------------------------------------------------------------------</value>
</value>
</data>
<data name="NextLineDescription" xml:space="preserve">
<value>Move the cursor to the next line if the input has multiple lines.</value>
Expand Down Expand Up @@ -751,28 +754,28 @@ Or not saving history with:
<data name="InvalidColorParameter" xml:space="preserve">
<value>Parameter must be a ConsoleColor, ANSI escape sequence, or RGB value with optional leading '#'.</value>
</data>
<data name="BasicGrouping" xml:space="preserve">
<data name="BasicGrouping" xml:space="preserve">
<value>Basic editing functions</value>
</data>
<data name="CursorMovementGrouping" xml:space="preserve">
<data name="CursorMovementGrouping" xml:space="preserve">
<value>Cursor movement functions</value>
</data>
<data name="HistoryGrouping" xml:space="preserve">
<data name="HistoryGrouping" xml:space="preserve">
<value>History functions</value>
</data>
<data name="CompletionGrouping" xml:space="preserve">
<data name="CompletionGrouping" xml:space="preserve">
<value>Completion functions</value>
</data>
<data name="MiscellaneousGrouping" xml:space="preserve">
<data name="MiscellaneousGrouping" xml:space="preserve">
<value>Miscellaneous functions</value>
</data>
<data name="SelectionGrouping" xml:space="preserve">
<data name="SelectionGrouping" xml:space="preserve">
<value>Selection functions</value>
</data>
<data name="SearchGrouping" xml:space="preserve">
<data name="SearchGrouping" xml:space="preserve">
<value>Search functions</value>
</data>
<data name="CustomGrouping" xml:space="preserve">
<data name="CustomGrouping" xml:space="preserve">
<value>User defined functions</value>
</data>
</root>
</root>
10 changes: 9 additions & 1 deletion PSReadLine/ReadLine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Linq;
using System.Management.Automation;
using System.Management.Automation.Language;
using System.Management.Automation.Runspaces;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
Expand Down Expand Up @@ -410,7 +412,13 @@ public static string ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsi
}
}

console.WriteLine(string.Format(CultureInfo.CurrentUICulture, PSReadLineResources.OopsAnErrorMessage2, _lastNKeys.Count, sb, e));
var psVersion = PSObject.AsPSObject(engineIntrinsics.Host.Version).ToString();
var ourVersion = typeof(PSConsoleReadLine).Assembly.GetCustomAttributes<AssemblyInformationalVersionAttribute>().First().InformationalVersion;
var osInfo = RuntimeInformation.OSDescription;

console.WriteLine(string.Format(CultureInfo.CurrentUICulture, PSReadLineResources.OopsAnErrorMessage2,
ourVersion, psVersion, osInfo,
_lastNKeys.Count, sb, e));
var lineBeforeCrash = _singleton._buffer.ToString();
_singleton.Initialize(runspace, _singleton._engineIntrinsics);
InvokePrompt();
Expand Down

0 comments on commit 57bc3a6

Please sign in to comment.