当前位置: 首页>>代码示例>>C#>>正文


C# ErrorEventArgs.GetException方法代码示例

本文整理汇总了C#中System.IO.ErrorEventArgs.GetException方法的典型用法代码示例。如果您正苦于以下问题:C# ErrorEventArgs.GetException方法的具体用法?C# ErrorEventArgs.GetException怎么用?C# ErrorEventArgs.GetException使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.IO.ErrorEventArgs的用法示例。


在下文中一共展示了ErrorEventArgs.GetException方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ValidateErrorEventArgs

        private static void ValidateErrorEventArgs(Exception exception)
        {
            ErrorEventArgs args = new ErrorEventArgs(exception);

            Assert.Equal(exception, args.GetException());

            // Make sure method is consistent.
            Assert.Equal(exception, args.GetException());
        }
开发者ID:SGuyGe,项目名称:corefx,代码行数:9,代码来源:ErrorEventArgs.unit.cs

示例2: OnError

        private static void OnError(object sender, ErrorEventArgs e)
        {
            var exception = e.GetException();
            Console.Error.WriteLine($"Hit an Exception with HResult '{ exception.HResult }'" +
                Environment.NewLine +
                $"{ exception }");

            Environment.FailFast(exception.Message);
        }
开发者ID:dougbu,项目名称:WatchLots,代码行数:9,代码来源:Program.cs

示例3: OnError

        private void OnError(object sender, ErrorEventArgs e)
        {
            e.GetException().ToExceptionless().Submit();

            if (InvokeRequired)
            {
                BeginInvoke(new ErrorEventHandler(OnError), sender, e);
                return;
            }

            MessageBox.Show(Constants.Messages.Error + e.GetException().InnerException,
                            Constants.Messages.ErrorCaption,
                            MessageBoxButtons.OK, MessageBoxIcon.Error);
            Console.WriteLine(Constants.Messages.Error + e.GetException().InnerException);
        }
开发者ID:gr0ss,项目名称:RegistryMonitor,代码行数:15,代码来源:Form1.cs

示例4: PackReceived_Error

 private void PackReceived_Error(object sender, ErrorEventArgs e)
 {
     Terminal.Instance.Client.Notifier.Log(TraceLevel.Error, e.GetException().ToString());
 }
开发者ID:sergiosorias,项目名称:terminalzero,代码行数:4,代码来源:ZeroMasterDataModule.cs

示例5: watcher_Error

        /// <summary>
        /// Handles the Error event of the watcher control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="ErrorEventArgs" /> instance containing the event data.</param>
        void watcher_Error(object sender, ErrorEventArgs e)
        {
            var ex = e.GetException();
            var dw = (FileSystemWatcher)sender;

            Logger.ErrorException("Error in Directory watcher for: " + dw.Path, ex);

            DisposeWatcher(dw);
        }
开发者ID:t-andre,项目名称:Emby,代码行数:14,代码来源:LibraryMonitor.cs

示例6: OnFileError

 /// <summary>
 ///     Callback for <see cref="FileSystemWatcher" /> file error events.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void OnFileError(object sender, ErrorEventArgs e)
 {
     _tailActor.Tell(new TailActor.FileError(_fileNameOnly, e.GetException().Message), ActorRefs.NoSender);
 }
开发者ID:EthanSteiner,项目名称:akka-bootcamp,代码行数:9,代码来源:FileObserver.cs

示例7: watcher_Error

        /// <summary>
        /// Handles the Error event of the watcher control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="ErrorEventArgs" /> instance containing the event data.</param>
        async void watcher_Error(object sender, ErrorEventArgs e)
        {
            var ex = e.GetException();
            var dw = (FileSystemWatcher)sender;

            Logger.ErrorException("Error in Directory watcher for: " + dw.Path, ex);

            //Network either dropped or, we are coming out of sleep and it hasn't reconnected yet - wait and retry
            var retries = 0;
            var success = false;
            while (!success && retries < 10)
            {
                await Task.Delay(500).ConfigureAwait(false);

                try
                {
                    dw.EnableRaisingEvents = false;
                    dw.EnableRaisingEvents = true;
                    success = true;
                }
                catch (ObjectDisposedException)
                {
                    RemoveWatcherFromList(dw);
                    return;
                }
                catch (IOException)
                {
                    Logger.Warn("Network still unavailable...");
                    retries++;
                }
                catch (ApplicationException)
                {
                    Logger.Warn("Network still unavailable...");
                    retries++;
                }
            }
            if (!success)
            {
                Logger.Warn("Unable to access network. Giving up.");
                DisposeWatcher(dw);
            }
        }
开发者ID:rrb008,项目名称:MediaBrowser,代码行数:47,代码来源:DirectoryWatchers.cs

示例8: onError

 void onError(object sender, ErrorEventArgs e)
 {
     throw new Exception("{0}: File system watcher error {1}".format(_path, e.GetException().Message));
 }
开发者ID:pragmatrix,项目名称:InConcert,代码行数:4,代码来源:Watcher.cs

示例9: GameManagerOnOnError

 private void GameManagerOnOnError(object sender, ErrorEventArgs errorEventArgs)
 {
     MessageBox.Show(errorEventArgs.GetException().ToString(), "Error creating game");
 }
开发者ID:rba100,项目名称:foosnet,代码行数:4,代码来源:NotifyWindowViewModel.cs

示例10: watcher_Error

 void watcher_Error(object sender, ErrorEventArgs e)
 {
     MPTVSeriesLog.Write("File Watcher: Error event: " + e.GetException().Message);
     refreshWatchers = true;
 }
开发者ID:barneh,项目名称:mptvseries,代码行数:5,代码来源:Watcher.cs

示例11: watcher_Error

 private void watcher_Error(object sender, ErrorEventArgs e)
 {
     Interface.Oxide.NextTick(() =>
     {
         Interface.Oxide.LogError("FSWatcher error: {0}", e.GetException());
         RemoteLogger.Exception("FSWatcher error", e.GetException());
     });
 }
开发者ID:OlympusServers,项目名称:Oxide,代码行数:8,代码来源:FSWatcher.cs

示例12: ConfirmedCommandConverter_Error

 private void ConfirmedCommandConverter_Error(object sender, ErrorEventArgs e)
 {
     _tracer.TraceError(e.GetException());
 }
开发者ID:trzombie,项目名称:ProjectConfigurationManager,代码行数:4,代码来源:PropertiesView.xaml.cs

示例13: FileSystemWatcherError

		void FileSystemWatcherError(object source, ErrorEventArgs e)
		{
			Console.WriteLine(e.GetException().ToString());
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:4,代码来源:TestResultsMonitor.cs

示例14: w_Error

        static void w_Error(object sender, ErrorEventArgs e) {
            var h = Program.WatchNotify;
            var ex = e.GetException();
            if (!(ex is System.IO.IOException)) {
                if (h != null) {
                    h(sender, new WatcherNotifyEventArgs(true, e.GetException()));
                } else {
                    Console.WriteLine("Error: {0} : {1}",
                                      e.GetException().GetType().Name,
                                      e.GetException().Message);

                }
            }
        }
开发者ID:jamie-pate,项目名称:FuseBoxFreedom,代码行数:14,代码来源:Program.cs

示例15: OnError

 private void OnError(object sender, ErrorEventArgs e)
 {
     // Error event is raised when the directory being watched gets deleted
     // in cases when a parent to that directory is deleted, this handler should 
     // finish quickly so the deletion does not fail.
     HostingEnvironment.QueueBackgroundWorkItem(cancellationToken =>
     {
         Exception ex = e.GetException();
         _traceFactory.GetTracer().TraceError(ex.ToString());
         ResetWatcher();
     });
 }
开发者ID:wonderxboy,项目名称:kudu,代码行数:12,代码来源:JobsFileWatcher.cs


注:本文中的System.IO.ErrorEventArgs.GetException方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。