Hello.
I would like to send UE4 crash information via C# SDK or C# HttpClient, is it possible?
because,I need to send an additional Attachment to Sentry, but I don’t want to modify UnrealEngine to do so.
My current Code is here.
using (SentrySdk.Init(o =>
{
o.Dsn = "{URL}";
o.Debug = true;
o.TracesSampleRate = 1.0;
}))
{
SentrySdk.ConfigureScope(scope =>
{
scope.AddAttachment("{Custom Attachment Path}}");
});
SentrySdk.CaptureMessage("Custom Error Report",SentryLevel.Error);
}
This will send an event with Sentry (the message) and it’ll include a file as an attachment but it will not process that attachment as if it were an UE4 crash report.
If that’s the original blob (that contains the minidump, logs, etc), you can try setting the attachment type when adding it, to: sentry-dotnet/Attachment.cs at a9304a0a4b4702d0e62e2703d55c66483d27a0e5 · getsentry/sentry-dotnet · GitHub
@jauer might know if that is supported
thank you for reply.
When I specify the AttachmentType, the issue no longer reflects it, even though there is no error. Why is this?
Sentry is likely trying to try to process it and drops it after. Not sure. Do you get a second event after with the UE4 crash info?
UE4 crash report that type represents is a blob that includes diferent files in a single compressed archive.
If you are attaching just the XML, minidump,.ini or the log files then it’s not really what sentry expects.
I thought so too.
So I added the code like this, but it didn’t change the result.
I’m trying to figure it out by comparing it to the UE4 code, but I can’t pinpoint the cause…
SentrySdk.ConfigureScope(scope =>
{
scope.SetExtra("AppID", "CrashReporter");
scope.SetExtra("AppVersion", "{APPVERSION}}");
scope.SetExtra("AppEnvironment", "Release");
scope.SetExtra("UploadType", "crashreports");
scope.SetExtra("UserID", "{UserID}}");
scope.AddAttachment("~/{ConsoleLog}.log", AttachmentType.UnrealLogs);
scope.AddAttachment("~/UE4Minidump.dmp", AttachmentType.Minidump);
scope.AddAttachment("~/CrashContext.runtime-xml", AttachmentType.UnrealContext);
scope.AddAttachment("~/CrashReportClient.ini", AttachmentType.UnrealContext);
});
I also tried it with HttpClient.
I confirmed that StatusCode200 was returned, but nothing was reflected in the Sentry dashboard.
My current Code is here.
private async void PostRequest(string url)
{
using(var httpClient = new HttpClient())
using (MultipartFormDataContent content = new MultipartFormDataContent())
using (var logContent = new StringContent(logText, Encoding.UTF8, "application/json"))
using (var xmlContent = new StringContent(xmlText, Encoding.UTF8, "application/json"))
using (var minidumpContent = new StringContent(miniDump.ToString(), Encoding.UTF8, "application/json"))
{
content.Add(logContent);
content.Add(xmlContent);
content.Add(minidumpContent);
var httpResponse = await httpClient.PostAsync(url, content);
}
}
No, the crash reporter does not generate any event (crash, etc.) after executing the SDK’s CaptureMessage function.
I figured it was a parameter, no?
What else do I need to give it?
Sentry’s UE4 support is done through the UE4 endpoint which processes the blob and picks apart each individual part. What you’re doing should result in a .NET event with 4 attachments but not special handling of the attachments (logs as crumbs and minidump processing).
Not sure there’s a plan to support “UE4 payloads” through envelopes sent by other SDKs. Maybe @Swatinem can comment on this
thank you.
I understood about the SDK.
I would like to send the same way as UE4 with HttpClient, do you know how to do that?
I would like to know the API specification.
I think it is different from the API specification in the official Sentry documentation.
You’d need to mimic what the UE4 Crash Reporter does, how it creates the request and send it to Sentry’s /unreal
endpoint that Sentry has on the project settings page. The crash reporter code is on GitHub if you join Epic’s GitHub org: https://github.com/EpicGames/UnrealEngine
The code Sentry has that reads that payload is here: symbolic/symbolic-unreal at master · getsentry/symbolic · GitHub