Skip to content

Commit feea233

Browse files
authored
fix: windows DotNetExceptionReporter build error (#89)
1 parent 2cdc993 commit feea233

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

Runtime/BugSplat.cs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -201,21 +201,21 @@ bool useNativeLibAndroid
201201
throw new ArgumentException("BugSplat error: version cannot be null or empty");
202202
}
203203

204-
#if UNITY_STANDALONE_WIN || UNITY_WSA
205-
204+
var gameObject = new GameObject();
205+
206+
#if UNITY_STANDALONE_WIN || UNITY_WSA
206207
var bugsplat = new BugSplatDotNetStandard.BugSplat(database, application, version);
207208
bugsplat.MinidumpType = BugSplatDotNetStandard.BugSplat.MinidumpTypeId.UnityNativeWindows;
208209
bugsplat.ExceptionType = BugSplatDotNetStandard.BugSplat.ExceptionTypeId.Unity;
209210
var dotNetStandardClientSettings = new DotNetStandardClientSettingsRepository(bugsplat);
210211
var dotNetStandardClient = new DotNetStandardClient(bugsplat);
211-
var dotNetStandardExceptionReporter = new DotNetStandardExceptionReporter(dotNetStandardClientSettings, dotNetStandardClient);
212+
var dotNetStandardExceptionReporter = DotNetStandardExceptionReporter.Create(dotNetStandardClientSettings, dotNetStandardClient, gameObject);
212213
var windowsReporter = new WindowsReporter(dotNetStandardClientSettings, dotNetStandardExceptionReporter, dotNetStandardClient);
213214

214215
clientSettings = dotNetStandardClientSettings;
215216
exceptionReporter = windowsReporter;
216217
nativeCrashReporter = windowsReporter;
217218
#elif UNITY_WEBGL
218-
var gameObject = new GameObject();
219219
var webGLClientSettings = new WebGLClientSettingsRepository();
220220
var webGLExceptionClient = new WebGLExceptionClient(database, application, version);
221221
var webGLReporter = WebGLReporter.Create(
@@ -241,21 +241,19 @@ bool useNativeLibAndroid
241241
javaClass.CallStatic("initBugSplat", activity, database, application, version);
242242
}
243243

244-
UseDotNetHandler(database, application, version);
244+
UseDotNetHandler(database, application, version, gameObject);
245245
#else
246-
UseDotNetHandler(database, application, version);
246+
UseDotNetHandler(database, application, version, gameObject);
247247
#endif
248248
}
249249

250-
private void UseDotNetHandler(string database, string application, string version)
250+
private void UseDotNetHandler(string database, string application, string version, GameObject gameObject)
251251
{
252252
var bugsplat = new BugSplatDotNetStandard.BugSplat(database, application, version)
253253
{
254254
MinidumpType = BugSplatDotNetStandard.BugSplat.MinidumpTypeId.UnityNativeWindows,
255255
ExceptionType = BugSplatDotNetStandard.BugSplat.ExceptionTypeId.Unity
256256
};
257-
258-
var gameObject = new GameObject();
259257
var dotNetStandardClientSettings = new DotNetStandardClientSettingsRepository(bugsplat);
260258
var dotNetStandardClient = new DotNetStandardClient(bugsplat);
261259
var dotNetStandardExceptionReporter = DotNetStandardExceptionReporter.Create(dotNetStandardClientSettings, dotNetStandardClient, gameObject);

0 commit comments

Comments
 (0)