-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor Global exception handling II
- The exception information has been extended with useful information. - If the checkbox remains marked, the details are sent to our log endpoint.
- Loading branch information
Showing
15 changed files
with
589 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
src/TumblThree/TumblThree.Applications/DataModels/LogException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
using System; | ||
|
||
namespace TumblThree.Applications.DataModels | ||
{ | ||
[Serializable] | ||
public class LogException | ||
{ | ||
public LogException(Exception ex, bool isLongPathSupported, | ||
string winVersion, string winEdition, string winBitness, string winReleaseId, string winVersionNumber, | ||
string tumblThreeVersion, string tumblThreeBitness, | ||
string defaultBrowser, string defaultBrowserVersion, | ||
string winRegionCulture, string winRegionCountry, | ||
string netFrameworkVersion, string netFrameworkBitness, | ||
DateTime timestamp) | ||
{ | ||
ExceptionMessage = ex?.Message; | ||
ExceptionType = ex.GetType().FullName; | ||
Callstack = ex.StackTrace; | ||
InnerException = ex.InnerException?.ToString(); | ||
IsLongPathSupported = isLongPathSupported; | ||
WinVersion = winVersion; | ||
WinEdition = winEdition; | ||
WinBitness = winBitness; | ||
WinReleaseId = winReleaseId; | ||
WinVersionNumber = winVersionNumber; | ||
TumblThreeVersion = tumblThreeVersion; | ||
TumblThreeBitness = tumblThreeBitness; | ||
DefaultBrowser = defaultBrowser; | ||
DefaultBrowserVersion = defaultBrowserVersion; | ||
WinRegionCulture = winRegionCulture; | ||
WinRegionCountry = winRegionCountry; | ||
NetFrameworkVersion = netFrameworkVersion; | ||
NetFrameworkBitness = netFrameworkBitness; | ||
Timestamp = timestamp; | ||
} | ||
|
||
public string ExceptionMessage { get; set; } | ||
|
||
public string ExceptionType { get; set; } | ||
|
||
public string Callstack { get; set; } | ||
|
||
public string InnerException { get; set; } | ||
|
||
public bool IsLongPathSupported { get; set; } | ||
|
||
public string WinVersion { get; set; } | ||
|
||
public string WinEdition { get; set; } | ||
|
||
public string WinBitness { get; set; } | ||
|
||
public string WinReleaseId { get; set; } | ||
|
||
public string WinVersionNumber { get; set; } | ||
|
||
public string TumblThreeBitness { get; set; } | ||
|
||
public string TumblThreeVersion { get; set; } | ||
|
||
public string DefaultBrowser { get; set; } | ||
|
||
public string DefaultBrowserVersion { get; set; } | ||
|
||
public string WinRegionCulture { get; set; } | ||
|
||
public string WinRegionCountry { get; set; } | ||
|
||
public string NetFrameworkVersion { get; set; } | ||
|
||
public string NetFrameworkBitness { get; set; } | ||
|
||
public DateTime Timestamp { get; set; } | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/TumblThree/TumblThree.Applications/Extensions/NativeMethods.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System.Runtime.InteropServices; | ||
using System.Security; | ||
|
||
namespace TumblThree.Applications.Extensions | ||
{ | ||
internal static class NativeMethods | ||
{ | ||
[SecurityCritical] | ||
[DllImport("ntdll.dll", SetLastError = true, CharSet = CharSet.Unicode)] | ||
internal static extern int RtlGetVersion(ref OSVERSIONINFOEX versionInfo); | ||
|
||
[StructLayout(LayoutKind.Sequential)] | ||
internal struct OSVERSIONINFOEX | ||
{ | ||
// The OSVersionInfoSize field must be set to Marshal.SizeOf(typeof(OSVERSIONINFOEX)) | ||
internal int OSVersionInfoSize; | ||
internal int MajorVersion; | ||
internal int MinorVersion; | ||
internal int BuildNumber; | ||
internal int PlatformId; | ||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] | ||
internal string CSDVersion; | ||
internal ushort ServicePackMajor; | ||
internal ushort ServicePackMinor; | ||
internal short SuiteMask; | ||
internal byte ProductType; | ||
internal byte Reserved; | ||
} | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/TumblThree/TumblThree.Applications/Services/ILogService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
|
||
namespace TumblThree.Applications.Services | ||
{ | ||
public interface ILogService | ||
{ | ||
string TumblThreeVersionString { get; } | ||
|
||
string WindowsVersionString { get; } | ||
|
||
string DefaultBrowserString { get; } | ||
|
||
string RegionSettingsString { get; } | ||
|
||
string NetFrameworkVersionString { get; } | ||
|
||
Task SendErrorDetails(Exception ex); | ||
} | ||
} |
Oops, something went wrong.