-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix crash on single-file app because of wrong assembly location
- Loading branch information
1 parent
b0731e1
commit 95c3e61
Showing
6 changed files
with
106 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
name: main | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
using System; | ||
//using System.Windows.Forms; | ||
using System.IO; | ||
using System.Threading; | ||
|
||
namespace Burntime | ||
{ | ||
//public class CustomExceptionHandler | ||
//{ | ||
// public void OnThreadException(object sender, UnhandledExceptionEventArgs args) | ||
// { | ||
// Exception e = args.ExceptionObject as Exception; | ||
// if (e == null) | ||
// { | ||
// MessageBox.Show("Error: Unknown", "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop); | ||
// } | ||
// else | ||
// { | ||
// ErrorMsg.LogException(e); | ||
|
||
// MessageBox.Show("Error: " + e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop); | ||
// } | ||
|
||
// // close | ||
// Environment.Exit(1); | ||
// } | ||
//}; | ||
|
||
static class ErrorMsg | ||
{ | ||
//public static void ShowError(string msg) | ||
//{ | ||
// MessageBox.Show("Error: " + msg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); | ||
//} | ||
|
||
//public static void ShowError(string msg, Exception e) | ||
//{ | ||
// MessageBox.Show("Error: " + msg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); | ||
// LogException(e); | ||
//} | ||
|
||
// add exception to errorlog.txt | ||
public static void LogException(Exception exception) | ||
{ | ||
var log = (StreamWriter writer, Exception e) => | ||
{ | ||
writer.WriteLine(); | ||
writer.WriteLine("----------------------------------------------------------------------"); | ||
writer.WriteLine(System.DateTime.Now.ToLocalTime().ToString()); | ||
writer.WriteLine("exception: " + e.Message); | ||
writer.WriteLine("trace:"); | ||
writer.Write(e.StackTrace); | ||
writer.WriteLine(); | ||
|
||
writer.Flush(); | ||
writer.Close(); | ||
}; | ||
|
||
try | ||
{ | ||
if (Platform.Log.File is not null) | ||
log(Platform.Log.File, exception); | ||
} | ||
catch { } | ||
|
||
using StreamWriter writer = new("crash.txt", true); | ||
log(writer, exception); | ||
|
||
#warning TODO message box? | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,21 @@ | ||
| ||
using Burntime; | ||
|
||
#if (DEBUG) | ||
|
||
using var game = new Burntime.MonoGl.BurntimeGame(); | ||
game.Run(); | ||
|
||
#else | ||
|
||
try | ||
{ | ||
using var game = new Burntime.MonoGl.BurntimeGame(); | ||
game.Run(); | ||
} | ||
catch (System.Exception exception) | ||
{ | ||
ErrorMsg.LogException(exception); | ||
} | ||
|
||
#endif |