本文整理汇总了C#中UnhandledExceptionEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# UnhandledExceptionEventArgs类的具体用法?C# UnhandledExceptionEventArgs怎么用?C# UnhandledExceptionEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UnhandledExceptionEventArgs类属于命名空间,在下文中一共展示了UnhandledExceptionEventArgs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: OnApplicationUnhandledException
static void OnApplicationUnhandledException(object sender, UnhandledExceptionEventArgs e)
{
var exception = e.ExceptionObject as Exception;
Debug.Assert(exception != null, "exception != null");
// Write the exception's details to a log file
using (var stream = new StreamWriter(Path.Combine(Utilities.ApplicationBaseDirectory, "CrashLogs.txt"), true)) {
stream.WriteLine(
Utilities.NewLineString +
exception.Message + Utilities.NewLineString +
exception.StackTrace
);
}
// Make sure that Monero core applications get closed before exit
if (Utilities.MoneroRpcManager != null) {
Utilities.MoneroRpcManager.Dispose();
}
if (Utilities.MoneroProcessManager != null) {
Utilities.MoneroProcessManager.Dispose();
}
// Exit with an error code
Environment.Exit(1);
}
开发者ID:kripod,项目名称:MoneroGui.Net,代码行数:26,代码来源:Program.cs
示例2: ExceptionHandler
private static void ExceptionHandler(object sender, UnhandledExceptionEventArgs args)
{
Exception e = (Exception) args.ExceptionObject;
Console.WriteLine("ExceptionHandler caught {0} with message {1}.\nExiting: ", e,
e.Message);
Environment.Exit(1);
}
开发者ID:ArildF,项目名称:masters,代码行数:7,代码来源:TestConcurrency.cs
示例3: SynchronizationContext_UnhandledException
private async void SynchronizationContext_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
e.Handled = true;
await new MessageDialog("Synchronization Context Unhandled Exception:\r\n" + e.Exception.Message)
.ShowAsync();
}
开发者ID:taojunfeng,项目名称:WinRTExceptions,代码行数:7,代码来源:App.xaml.cs
示例4: App_UnhandledException
private void App_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
var errorMessage = e.Exception.ToString();
Debug.WriteLine(errorMessage);
var message = new MessageDialog(errorMessage, "An error occurred").ShowAsync();
e.Handled = true;
}
开发者ID:Esri,项目名称:arcgis-runtime-samples-dotnet,代码行数:7,代码来源:App.xaml.cs
示例5: unhandledException
// Invoked when unhandled event occurs
static void unhandledException(object sender, UnhandledExceptionEventArgs args)
{
//TODO create some sort of notification service for unhandled exceptions
Exception e = (Exception)args.Exception;
Debug.WriteLine("MyHandler caught : " + e.Message);
}
开发者ID:Nodios,项目名称:Games-Store,代码行数:8,代码来源:App.xaml.cs
示例6: GetSongs
public Task<IEnumerable<Song>> GetSongs(string query, CancellationToken cancellationToken)
{
return Task.Factory.StartNew(() =>
{
var lockObject = new object();
var songs = new List<Song>(200);
Parallel.ForEach(Providers, p =>
{
try
{
var result = p.GetSongs(query, cancellationToken).Result;
lock (lockObject)
{
songs.AddRange(result);
}
}
catch(Exception e)
{
var args = new UnhandledExceptionEventArgs(e);
OnUnhandledException(args);
if (!args.Handled)
{
throw;
}
}
});
return (IEnumerable<Song>)songs.ToArray();
});
}
开发者ID:torshy,项目名称:TRock.Music,代码行数:33,代码来源:AggregateSongProvider.cs
示例7: App_UnhandledException
private async void App_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
e.Handled = true;
var unhandledException = e.Exception;
var dialog = new MessageDialog([email protected]"Homebased crashed :(
{Environment.NewLine}Please close the application and try again.
{Environment.NewLine}But before you do, do you want to mail us the crash report, to see if there's anything we can do?", "Homebased crashed #!$*");
dialog.Commands.Add(new UICommand("Yes", new UICommandInvokedHandler(async cmd =>
{
var sendTo = new EmailRecipient()
{
Name = "Homebased",
Address = "[email protected]"
};
var mail = new EmailMessage();
mail.Subject = $"Homebased crashed :(";
mail.Body = unhandledException.ToString();
mail.To.Add(sendTo);
await EmailManager.ShowComposeNewEmailAsync(mail);
})));
dialog.Commands.Add(new UICommand("No", new UICommandInvokedHandler(cmd =>
{
})));
await dialog.ShowAsync();
}
开发者ID:danpadmore,项目名称:homebased,代码行数:31,代码来源:App.xaml.cs
示例8: OnUnhandledException
static void OnUnhandledException (object sender, UnhandledExceptionEventArgs e)
{
lock (monitor) {
Monitor.Pulse (monitor);
}
Environment.Exit (0);
}
开发者ID:Zman0169,项目名称:mono,代码行数:7,代码来源:threadpool-exceptions1.cs
示例9: AppUnhandledException
private async void AppUnhandledException(object sender, UnhandledExceptionEventArgs e)
{
e.Handled = true;
await new MessageDialog("应用程序出错:\r\n" + e.Exception.Message)
.ShowAsync();
}
开发者ID:tianzhaodong,项目名称:uwp_AiJianShu,代码行数:7,代码来源:App.xaml.cs
示例10: App_UnhandledException
private async void App_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
_telemetryClientProvider.Client.TrackException(e.Exception);
_telemetryClientProvider.Client.Flush();
await new MessageDialog(e.Exception.Message).ShowAsync();
}
开发者ID:eurofurence,项目名称:ef-app_wp,代码行数:7,代码来源:App.xaml.cs
示例11: MyHandler
public static void MyHandler(object
sender,
UnhandledExceptionEventArgs
args)
{
Console.WriteLine("UnhandledExceptionEventHandler called");
}
开发者ID:robertmichaelwalsh,项目名称:Multilex,代码行数:7,代码来源:exception9.cs
示例12: CurrentDomain_UnhandledException
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
Exception theException = (Exception)e.ExceptionObject;
Console.WriteLine(theException.ToString());
// Exit to avoid unhandled exception dialog
Environment.Exit(-1);
}
开发者ID:Junch,项目名称:debug,代码行数:8,代码来源:Sample1.cs
示例13: App_UnhandledException
private void App_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
if (System.Diagnostics.Debugger.IsAttached)
{
// An unhandled exception has occurred; break into the debugger
System.Diagnostics.Debugger.Break();
}
}
开发者ID:parnic,项目名称:samsungremote,代码行数:8,代码来源:App.xaml.cs
示例14: App_UnhandledException
private void App_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
if (Debugger.IsAttached)
{
Debug.WriteLine(e.Message);
Debug.WriteLine(e.Exception.StackTrace);
}
}
开发者ID:iot-alex,项目名称:virtual-shields-universal,代码行数:8,代码来源:App.xaml.cs
示例15: App_UnhandledException
void App_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
LogHelper.Error(e.Exception);
//LOG Exception
e.Handled = true;
System.Diagnostics.Debug.WriteLine(string.Format("{1} @ {0} @ {2} ", e.Exception, e.Message,
e.Exception != null ? e.Exception.StackTrace : string.Empty));
//throw new NotImplementedException();
}
开发者ID:K-Library-NET,项目名称:dotNET,代码行数:9,代码来源:App.xaml.cs
示例16: App_UnhandledException
private void App_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
#if DEBUG
if (Debugger.IsAttached)
{
Debugger.Break();
}
#endif
}
开发者ID:holtsoftware,项目名称:House,代码行数:9,代码来源:App.xaml.cs
示例17: OnException
private static void OnException(object sender, UnhandledExceptionEventArgs eventArgs)
{
var exception = eventArgs.Exception;
exception.Data.Add("Message", eventArgs.Message);
// set as handled to allow reporting error and on complete shut down app
ReportingService.Instance.BeginReport(exception, OnReportCompleted);
eventArgs.Handled = true;
}
开发者ID:pirvudoru,项目名称:winbugfreak,代码行数:9,代码来源:BugFreak.cs
示例18: App_UnhandledException
void App_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
Crystal.Services.ServiceManager.Resolve<Crystal.Services.IMessageBoxService>()
.ShowMessage(
LocalizationManager.GetLocalizedValue("UnusualErrorHeader"),
LocalizationManager.GetLocalizedValue("UnusualErrorMsg") + Environment.NewLine + e.Message + Environment.NewLine + e.Exception.StackTrace);
e.Handled = true;
}
开发者ID:Amrykid,项目名称:Hanasu,代码行数:9,代码来源:App.xaml.cs
示例19: Current_UnhandledException
private async void Current_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
e.Handled = true;
logger.Info("Catched unobserved exception from Dispatcher! Type={0}, Message={1}", new object[] { e.Exception.GetType().Name, e.Exception.Message });
await HandleUnhandledException(e);
Application.Current.Exit();
}
开发者ID:tapanila,项目名称:HockeySDK-Windows,代码行数:9,代码来源:CrashHandler.cs
示例20: CurrentDomain_UnhandledException
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
if (e.IsTerminating)
{
LogTo.Error(e.ExceptionObject as Exception, "Could not show error dialog. Shutting down.");
return;
}
HandleException(e.ExceptionObject as Exception, "CurrentDomain_UnhandledException");
}
开发者ID:nagyist,项目名称:PlatformInstaller,代码行数:9,代码来源:ExceptionHandler.cs
注:本文中的UnhandledExceptionEventArgs类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论