Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DYN-7310 - Modify Github Crash Report to Allow for "Issue Report" from Help Menu, and "Crash Report" from Crash #15775

Merged
merged 7 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions src/DynamoCoreWpf/Utilities/CrashUtilities.cs
Original file line number Diff line number Diff line change
@@ -1,25 +1,30 @@
using Dynamo.Configuration;
using Dynamo.Configuration;
using Dynamo.PackageManager;
using Dynamo.Utilities;
using System;
using System.Collections.Generic;
using System.Linq;

namespace Dynamo.Wpf.Utilities
{
static class CrashUtilities
{
internal static string GithubNewIssueUrlFromCrashContent(object crashContent)
internal enum ReportType
{
Bug,
Crash
}

internal static string GithubNewIssueUrlFromCrashContent(object crashContent, ReportType reportType = ReportType.Crash)
{
var baseUri = new UriBuilder(Configurations.GitHubBugReportingLink);

var issueTitle = "Crash report from Dynamo {0}";
var issueTitle = "{0} report from Dynamo {1}";
johnpierson marked this conversation as resolved.
Show resolved Hide resolved
var dynamoVersion = AssemblyHelper.GetDynamoVersion().ToString() ?? "2.1.0+";

// append the title and body to the URL as query parameters
// making sure we properly escape content since stack traces may contain characters not suitable
// for use in URLs
var title = "title=" + Uri.EscapeDataString(string.Format(issueTitle, dynamoVersion));
var title = "title=" + Uri.EscapeDataString(string.Format(issueTitle, reportType, dynamoVersion));
var template = "template=issue.yml";
Copy link
Contributor

@QilongTang QilongTang Jan 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's been a while, can you double check here if reportType would be number or string. I remember vaguely that the real value of Enums will be number and you may need to grab the name of the Enum specifically here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It appears to pull the string from the enum on the string formatting portion.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for checking @johnpierson maybe the string.Format took care of it underneath already.

var fields = "dynamo_version=" + Uri.EscapeDataString(dynamoVersion)
+ "&os=" + Uri.EscapeDataString(Environment.OSVersion.ToString())
Expand Down
2 changes: 1 addition & 1 deletion src/DynamoCoreWpf/ViewModels/Core/DynamoViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1264,7 +1264,7 @@ internal bool CanDisplayFunction(object parameters)
/// <param name="bodyContent">Crash details body. If null, nothing will be filled-in.</param>
public static void ReportABug(object bodyContent)
{
var urlWithParameters = Wpf.Utilities.CrashUtilities.GithubNewIssueUrlFromCrashContent(bodyContent);
var urlWithParameters = Wpf.Utilities.CrashUtilities.GithubNewIssueUrlFromCrashContent(bodyContent, CrashUtilities.ReportType.Bug);

// launching the process using explorer.exe will format the URL incorrectly
// and Github will not recognise the query parameters in the URL
Expand Down
Loading