Skip to content
Permalink
Browse files

[CrashReport] Bumped crash report to 1.0.1 (force HTTPS), anonymize r…

…eports and make sure it doesn't conflict with NuGetAssemblyResolver
  • Loading branch information
xen2 committed Feb 25, 2019
1 parent 0e9c28f commit 401496a90cfb05ae84b83a5d9b10e6fb61875290
@@ -5,6 +5,7 @@
using System.Linq;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
using Xenko.Core.Assets.Editor.Components.Transactions;
#if DEBUG
using System.Diagnostics;
@@ -171,6 +172,18 @@ public static void SendReport(string exceptionMessage, int crashLocation, string

crashReport["Log"] = nonFatalReport.ToString();

// Try to anonymize reports
// It also makes it easier to copy and paste paths
for (var i = 0; i < crashReport.Data.Count; i++)
{
var data = crashReport.Data[i].Item2;

data = Regex.Replace(data, Regex.Escape(Environment.GetEnvironmentVariable("USERPROFILE")), Regex.Escape("%USERPROFILE%"), RegexOptions.IgnoreCase);
data = Regex.Replace(data, $@"\b{Regex.Escape(Environment.GetEnvironmentVariable("USERNAME"))}\b", Regex.Escape("%USERNAME%"), RegexOptions.IgnoreCase);

crashReport.Data[i] = Tuple.Create(crashReport.Data[i].Item1, data);
}

var reporter = new CrashReportForm(crashReport, new ReportSettings());
var result = reporter.ShowDialog();
XenkoGameStudio.MetricsClient?.CrashedSession(result == DialogResult.Yes);
@@ -209,6 +209,9 @@ private static void HandleException(Exception exception, int location)
if (terminating) return;
terminating = true;

// In case assembly resolve was not done yet, disable it altogether
NuGetAssemblyResolver.DisableAssemblyResolve();

var englishCulture = new CultureInfo("en-US");
var crashLogThread = new Thread(CrashReport) { CurrentUICulture = englishCulture, CurrentCulture = englishCulture };
crashLogThread.SetApartmentState(ApartmentState.STA);
@@ -43,7 +43,7 @@
<PackageReference Include="SharpDX" Version="4.0.1" />
<PackageReference Include="EnvDTE" Version="8.0.1" />
<PackageReference Include="Xenko.Metrics" Version="1.0.0" />
<PackageReference Include="Xenko.CrashReport" Version="1.0.0" />
<PackageReference Include="Xenko.CrashReport" Version="1.0.1" />
<Reference Include="Mono.Cecil">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(XenkoCommonDependenciesDir)Mono.Cecil\Mono.Cecil.dll</HintPath>
@@ -52,7 +52,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xenko.Metrics" Version="1.0.0" />
<PackageReference Include="Xenko.CrashReport" Version="1.0.0" />
<PackageReference Include="Xenko.CrashReport" Version="1.0.1" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Diagnostics.Debug" />
<Reference Include="System.Management" />
@@ -19,14 +19,19 @@
using NuGet.Protocol.Core.Types;
using NuGet.Versioning;

namespace Xenko.Core.Assets.CompilerApp
namespace Xenko.Core.Assets
{
class NuGetAssemblyResolver
{
static bool assembliesResolved;
static object assembliesLock = new object();
static List<string> assemblies;

internal static void DisableAssemblyResolve()
{
assembliesResolved = true;
}

[ModuleInitializer(-100000)]
internal static void __Initialize__()
{

0 comments on commit 401496a

Please sign in to comment.
You can’t perform that action at this time.