Skip to content

Commit

Permalink
Address review comments. Also check minidump.
Browse files Browse the repository at this point in the history
  • Loading branch information
sm6srw committed Jan 18, 2024
1 parent acd56b0 commit 2f20563
Showing 1 changed file with 29 additions and 16 deletions.
45 changes: 29 additions & 16 deletions src/DynamoCoreWpf/Utilities/CrashReportTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,11 @@ internal static bool ShowCrashErrorReportWindow(DynamoViewModel viewModel, Crash

DynamoModel model = viewModel?.Model;

string cerToolDir = !string.IsNullOrEmpty(model.CERLocation) ?
model.CERLocation : FindCERToolInInstallLocations();
string cerToolDir = !string.IsNullOrEmpty(model?.CERLocation) ?
model?.CERLocation : FindCERToolInInstallLocations();

var cerToolPath = !string.IsNullOrEmpty(cerToolDir) ? Path.Combine(cerToolDir, CERDllName) : string.Empty;

var cerToolPath = Path.Combine(cerToolDir, CERDllName);
if (string.IsNullOrEmpty(cerToolPath) || !File.Exists(cerToolPath))
{
model?.Logger?.LogError($"The CER tool was not found at location {cerToolPath}");
Expand All @@ -199,46 +200,44 @@ internal static bool ShowCrashErrorReportWindow(DynamoViewModel viewModel, Crash
{
string logFile = Path.Combine(cerDir.FullName, "DynamoLog.log");

try
if(File.Exists(logFile))
{
File.Copy(model.Logger.LogPath, logFile);
// might be useful to dump all loaded Packages into
// the log at this point.
filesToSend.Add(logFile);
}
catch (Exception ex)
else
{
model?.Logger?.LogError($"Failed to add DynamoLog.log to CER with the following error : {ex.Message}");
model?.Logger?.LogError($"Failed to add DynamoLog.log to CER with the following error : {logFile} Not Found");
}
}

if (args.SendSettingsFile && model != null)
{
string settingsFile = Path.Combine(cerDir.FullName, "DynamoSettings.xml");

try
if (File.Exists(settingsFile))
{
File.Copy(model.PathManager.PreferenceFilePath, settingsFile);

filesToSend.Add(settingsFile);
}
catch (Exception ex)
else
{
model?.Logger?.LogError($"Failed to add DynamoSettings.xml to CER with the following error : {ex.Message}");
model?.Logger?.LogError($"Failed to add DynamoSettings.xml to CER with the following error : {settingsFile} Not Found");
}
}

if (args.HasDetails())
{
var stackTracePath = Path.Combine(cerDir.FullName, "StackTrace.log");
try
if(File.Exists(stackTracePath))
{
File.WriteAllText(stackTracePath, args.Details);
filesToSend.Add(stackTracePath);
}
catch (Exception ex)
else
{
model?.Logger?.LogError($"Failed to add StackTrace.log to CER with the following error : {ex.Message}");
model?.Logger?.LogError($"Failed to add StackTrace.log to CER with the following error : {stackTracePath} Not Found ");
}
}

Expand All @@ -263,9 +262,23 @@ internal static bool ShowCrashErrorReportWindow(DynamoViewModel viewModel, Crash
$"session_start_count=\"0\" session_clean_close_count=\"0\" current_session_length=\"0\" />";
}

string dynName = viewModel?.Model.CurrentWorkspace.Name;
string dynName = model?.CurrentWorkspace.Name;

var miniDumpFilePath = string.Empty;
try
{
miniDumpFilePath = CreateMiniDumpFile(cerDir.FullName);
}
catch (Exception ex)
{
model?.Logger?.LogError($"Failed to generate minidump file for CER due to the following error : {ex.Message}");
}

if (string.IsNullOrEmpty(miniDumpFilePath))
{
return false;
}

var miniDumpFilePath = CreateMiniDumpFile(cerDir.FullName);
var upiConfigFilePath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "upiconfig.xml");

using (var cerDLL = new CerDLL(cerToolPath))
Expand Down

0 comments on commit 2f20563

Please sign in to comment.