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


C# ErrorReporter类代码示例

本文整理汇总了C#中ErrorReporter的典型用法代码示例。如果您正苦于以下问题:C# ErrorReporter类的具体用法?C# ErrorReporter怎么用?C# ErrorReporter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: VerifyDocumentUrl

 /// <summary>
 /// Verifies that the document represents a Url that matches the page metadata.
 /// </summary>
 /// <remarks>
 /// <para>
 /// The default implementation uses information from the associated <see cref="T:WatiN.Core.PageMetadata"/>
 ///             to validate the <paramref name="url"/>.
 /// </para>
 /// <para>
 /// Subclasses can override this method to customize how document Url verification takes place.
 /// </para>
 /// </remarks>
 /// <param name="url">The document url to verify, not null</param><param name="errorReporter">The error reporter to invoke is the document's properties fail verification</param>
 protected override void VerifyDocumentUrl(string url, ErrorReporter errorReporter)
 {
     if (!url.EndsWith("Dinners"))
     {
         errorReporter("This isn't the home page");
     }
 }
开发者ID:dennisdoomen,项目名称:specflowdemo,代码行数:20,代码来源:DinnersPage.cs

示例2: VerifyDocumentUrl

 /// <summary>
 /// Verifies that the document represents a Url that matches the page metadata.
 /// </summary>
 /// <remarks>
 /// <para>
 /// The default implementation uses information from the associated <see cref="T:WatiN.Core.PageMetadata"/>
 ///             to validate the <paramref name="url"/>.
 /// </para>
 /// <para>
 /// Subclasses can override this method to customize how document Url verification takes place.
 /// </para>
 /// </remarks>
 /// <param name="url">The document url to verify, not null</param><param name="errorReporter">The error reporter to invoke is the document's properties fail verification</param>
 protected override void VerifyDocumentUrl(string url, ErrorReporter errorReporter)
 {
     if (!url.ToLower().Contains("/logon"))
     {
         errorReporter("This isn't the home page");
     }
 }
开发者ID:dennisdoomen,项目名称:specflowdemo,代码行数:20,代码来源:LogOnPage.cs

示例3: Main

        static void Main()
        {
            var userInterface = new EmptyUserInterface {Flow = ExecutionFlow.BreakExecution};
            var settings = new DefaultSettings {HandleProcessCorruptedStateExceptions = true, UserInterface = userInterface};
            settings.Sender = new LocalSender();
            //Adding screenshot plugin
            settings.Plugins.Add(new ScreenShotWriter());
            var reporter = new ErrorReporter(settings);
            reporter.HandleExceptions = true;

            // Sample NCrash configuration for console applications
            AppDomain.CurrentDomain.UnhandledException += reporter.UnhandledException;
            TaskScheduler.UnobservedTaskException += reporter.UnobservedTaskException;

            Console.WriteLine("Press E for current thread exception, T for task exception, X for exit");
            ConsoleKey key;
            do
            {
                key = Console.ReadKey().Key;
                Console.WriteLine();
                if (key == ConsoleKey.E)
                {
                    Console.WriteLine("Throwing exception in current thread");
                    throw new Exception("Test exception in main thread");
                }
                if (key == ConsoleKey.T)
                {
                    Console.WriteLine("Throwing exception in task thread");
                    var task = new Task(MakeExceptionInTask);
                    task.Start();
                    task.Wait();
                }
            } while (key != ConsoleKey.X);
        }
开发者ID:mgnslndh,项目名称:NCrash,代码行数:34,代码来源:Program.cs

示例4: OsloCodeGeneratorInfo

        public OsloCodeGeneratorInfo(string fileName, TextReader fileContent, bool ignoreIncludes, ErrorReporter errorReporter)
        {
            this.CodeParser = OsloCodeGeneratorLanguages.GetOsloCodeGeneratorParser();
            this.TemplateParser = OsloCodeGeneratorLanguages.GetOsloCodeGeneratorTemplateParser();
            this.CodePrinter = null;
            this.ErrorReporter = errorReporter;

            this.References = new SortedSet<string>();
            this.Usings = new SortedSet<string>();
            this.Imports = new SortedSet<string>();
            this.Includes = new List<OsloCodeGeneratorInfo>();

            //this.IgnoreIncludes = ignoreIncludes;
            this.IgnoreIncludes = false;
            if (fileName != null)
            {
                this.FileName = Path.GetFullPath(fileName);
                if (!File.Exists(this.FileName))
                {
                    this.ErrorReporter.Error("File not found: {0}", fileName);
                }
            }
            this.Program = this.CodeParser.Parse(fileContent, this.ErrorReporter);

            this.Usings.Add("System");
            this.Usings.Add("System.Collections.Generic");
            this.Usings.Add("System.Linq");
            this.Usings.Add("System.Text");
            this.Usings.Add("OsloExtensions");
            this.Usings.Add("OsloExtensions.Extensions");
            this.Includes.Add(this);

            this.FunctionCount = 0;
            new OsloCodeGeneratorUsingProcessor(this, this).Process(this.Program);
        }
开发者ID:st9200,项目名称:soal-oslo,代码行数:35,代码来源:OsloCodeGeneratorInfo.cs

示例5: Argument

            public Argument(ArgumentAttribute attribute, FieldInfo field, ErrorReporter reporter)
            {
                this.longName = Parser.LongName (attribute, field);
                this.explicitShortName = Parser.ExplicitShortName (attribute);
                this.shortName = Parser.ShortName (attribute, field);
                this.hasHelpText = Parser.HasHelpText (attribute);
                this.helpText = Parser.HelpText (attribute);
                this.defaultValue = Parser.DefaultValue (attribute);
                this.elementType = ElementType (field);
                this.flags = Flags (attribute, field);
                this.field = field;
                this.SeenValue = false;
                this.reporter = reporter;
                this.isDefault = attribute != null && attribute is DefaultArgumentAttribute;

                if (this.IsCollection)
                    this.collectionValues = new ArrayList ();

                Debug.Assert (!String.IsNullOrEmpty (this.longName));
                Debug.Assert (!this.isDefault || !this.ExplicitShortName);
                Debug.Assert (!this.IsCollection || this.AllowMultiple, "Collection arguments must have allow multiple");
                Debug.Assert (!this.Unique || this.IsCollection, "Unique only applicable to collection arguments");
                Debug.Assert (IsValidElementType (this.Type) ||
                              IsCollectionType (this.Type));
                Debug.Assert ((this.IsCollection && IsValidElementType (this.elementType)) ||
                              (!this.IsCollection && this.elementType == null));
                Debug.Assert (!(this.IsRequired && this.HasDefaultValue), "Required arguments cannot have default value");
                Debug.Assert (!this.HasDefaultValue || (this.defaultValue.GetType () == field.FieldType),
                              "Type of default value must match field type");
            }
开发者ID:victorsamun,项目名称:NSimulator,代码行数:30,代码来源:Argument.cs

示例6: ForEval

 internal static ErrorReporter ForEval (ErrorReporter reporter)
 {
     DefaultErrorReporter r = new DefaultErrorReporter ();
     r.forEval = true;
     r.chainedReporter = reporter;
     return r;
 }
开发者ID:hazzik,项目名称:EcmaScript.NET,代码行数:7,代码来源:DefaultErrorReporter.cs

示例7: Main

		static int Main(string[] args)
		{
			CommandLineParser parser = new CommandLineParser( args );

			if (parser.RegistrationPath.Length == 0)
					parser.RegistrationPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetAssembly(typeof(RegistrarApp)).Location);

			try
			{
				AssemblyRegistrar registrar = new AssemblyRegistrar( parser );

				if( parser.RegisterMode == CommandLineParser.InstallMode.Register )
					registrar.Register();
				else
				{
					try
					{
						registrar.UnRegister();
					}
					catch
					{
						// ignore the exception
					}
				}
				return (int) ReturnValue.Success;
			}
			catch( Exception ex )
			{
				System.Diagnostics.Debug.Assert(false, ex.Message);
				ErrorReporter reporter = new ErrorReporter(parser.RegistrationPath, parser.SilentMode);
				reporter.Report(ex.Message);
				return (int) ReturnValue.Failure;
			}
		}
开发者ID:killbug2004,项目名称:WSProf,代码行数:34,代码来源:RegistrarApp.cs

示例8: Report

 public void Report()
 {
     ExceptionForm form = new ExceptionForm(message, ex);
     if (form.ShowDialog(owner) == DialogResult.OK) {
         ErrorReporter reporter = new ErrorReporter();
         reporter.Report(ex);
     }
 }
开发者ID:xwiz,项目名称:WixEdit,代码行数:8,代码来源:ErrorReportHandler.cs

示例9: SetErrorReporter

		public virtual void SetErrorReporter(ErrorReporter errorReporter)
		{
			if (errorReporter == null)
			{
				throw new ArgumentException();
			}
			this.errorReporter = errorReporter;
		}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:8,代码来源:CompilerEnvirons.cs

示例10: Parser

        /// <summary>
        ///     Creates a new command line argument parser.
        /// </summary>
        /// <param name="argumentSpecification"> The type of object to parse. </param>
        /// <param name="reporter"> The destination for parse errors. </param>
        private Parser(Type argumentSpecification, ErrorReporter reporter)
        {
            this.reporter = reporter;
            this.reporter += Log.Error;
            this.arguments = new ArrayList();
            this.argumentMap = new Hashtable();

            foreach (FieldInfo field in argumentSpecification.GetFields())
            {
                if (!field.IsStatic && !field.IsInitOnly && !field.IsLiteral)
                {
                    ArgumentAttribute attribute = GetAttribute(field);
                    if (attribute is DefaultArgumentAttribute)
                    {
                        Debug.Assert(this.defaultArgument == null);
                        this.defaultArgument = new Argument(attribute, field, reporter);
                    }
                    else
                    {
                        this.arguments.Add(new Argument(attribute, field, reporter));
                    }
                }
            }

            // add explicit names to map
            foreach (Argument argument in this.arguments)
            {
                Debug.Assert(!this.argumentMap.ContainsKey(argument.LongName));
                this.argumentMap[argument.LongName] = argument;
                if (argument.ExplicitShortName)
                {
                    if (!string.IsNullOrEmpty(argument.ShortName))
                    {
                        Debug.Assert(!this.argumentMap.ContainsKey(argument.ShortName));
                        this.argumentMap[argument.ShortName] = argument;
                    }
                    else
                    {
                        argument.ClearShortName();
                    }
                }
            }

            // add implicit names which don't collide to map
            foreach (Argument argument in this.arguments)
            {
                if (!argument.ExplicitShortName)
                {
                    if (!string.IsNullOrEmpty(argument.ShortName) &&
                        !this.argumentMap.ContainsKey(argument.ShortName))
                        this.argumentMap[argument.ShortName] = argument;
                    else
                        argument.ClearShortName();
                }
            }
        }
开发者ID:RSchwoerer,项目名称:Terminals,代码行数:61,代码来源:Parser.cs

示例11: QueryCompiler

		/// <summary>
		/// Creates a new instance of the QueryCompiler.
		/// </summary>
		/// <param name="reporter">A delegate to report any errors to an upper layer.</param>
		/// <param name="query">The query to compile.</param>
		public QueryCompiler(ErrorReporter reporter, string query)
		{
			if (reporter == null)
				throw new ArgumentNullException("reporter");
			if (query == null)
				throw new ArgumentNullException("query");
			
			this.report = reporter;
			this.currentQuery = query;
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:15,代码来源:QueryCompiler.cs

示例12: Parser

 public Parser(Type argumentSpecification, ErrorReporter reporter)
 {
     this.reporter = reporter;
     arguments = new ArrayList();
     argumentMap = new Hashtable();
     FieldInfo[] fields = argumentSpecification.GetFields();
     for (int i = 0; i < fields.Length; i++)
     {
         FieldInfo field = fields[i];
         if (!field.IsStatic && !field.IsInitOnly && !field.IsLiteral)
         {
             ArgumentAttribute attribute = GetAttribute(field);
             if (attribute is DefaultArgumentAttribute)
             {
                 Debug.Assert(defaultArgument == null);
                 defaultArgument = new Argument(attribute, field, reporter);
             }
             else
             {
                 arguments.Add(new Argument(attribute, field, reporter));
             }
         }
     }
     foreach (Argument argument in arguments)
     {
         Debug.Assert(!argumentMap.ContainsKey(argument.LongName));
         argumentMap[argument.LongName] = argument;
         if (argument.ExplicitShortName)
         {
             if (argument.ShortName != null && argument.ShortName.Length > 0)
             {
                 Debug.Assert(!argumentMap.ContainsKey(argument.ShortName));
                 argumentMap[argument.ShortName] = argument;
             }
             else
             {
                 argument.ClearShortName();
             }
         }
     }
     foreach (Argument argument in arguments)
     {
         if (!argument.ExplicitShortName)
         {
             if (argument.ShortName != null && argument.ShortName.Length > 0 && !argumentMap.ContainsKey(argument.ShortName))
             {
                 argumentMap[argument.ShortName] = argument;
             }
             else
             {
                 argument.ClearShortName();
             }
         }
     }
 }
开发者ID:bittercoder,项目名称:HeatSite,代码行数:55,代码来源:Parser.cs

示例13: CompilerEnvirons

 public CompilerEnvirons()
 {
     errorReporter = DefaultErrorReporter.instance;
     languageVersion = Context.Versions.Default;
     generateDebugInfo = true;
     useDynamicScope = false;
     reservedKeywordAsIdentifier = false;
     allowMemberExprAsFunctionName = false;
     xmlAvailable = true;
     optimizationLevel = 0;
     generatingSource = true;
 }
开发者ID:arifbudiman,项目名称:TridionMinifier,代码行数:12,代码来源:CompilerEnvirons.cs

示例14: CommandLineArgumentParser

		/// <summary>
		/// Creates a new command line argument parser.
		/// </summary>
		/// <param name="argumentSpecification"> The type of object to  parse. </param>
		/// <param name="reporter"> The destination for parse errors. </param>
		public CommandLineArgumentParser(Type argumentSpecification, ErrorReporter reporter)
		{
			this.reporter = reporter;
			this.arguments = new ArrayList();
			this.argumentMap = new Hashtable();
            
			foreach (FieldInfo field in argumentSpecification.GetFields())
			{
				if (!field.IsStatic && !field.IsInitOnly && !field.IsLiteral)
				{
					CommandLineArgumentAttribute attribute = GetAttribute(field);
					if (attribute is DefaultCommandLineArgumentAttribute)
					{
						if (this.defaultArgument!=null)
							ThrowError("More that one DefaultCommandLineArgument has been used");
						this.defaultArgument = new Argument(attribute, field, reporter);
					}
					else
					{
						this.arguments.Add(new Argument(attribute, field, reporter));
					}
				}
			}
            
			// add explicit names to map
			foreach (Argument argument in this.arguments)
			{
				if (argumentMap.ContainsKey(argument.LongName))
					ThrowError("Argument {0} is duplicated",argument.LongName);
				this.argumentMap[argument.LongName] = argument;
				if (argument.ExplicitShortName && argument.ShortName != null && argument.ShortName.Length > 0)
				{
					if(this.argumentMap.ContainsKey(argument.ShortName))
						ThrowError("Argument {0} is duplicated",argument.ShortName);
					this.argumentMap[argument.ShortName] = argument;
				}
			}
            
			// add implicit names which don't collide to map
			foreach (Argument argument in this.arguments)
			{
				if (!argument.ExplicitShortName && argument.ShortName != null && argument.ShortName.Length > 0)
				{
					if (!argumentMap.ContainsKey(argument.ShortName))
						this.argumentMap[argument.ShortName] = argument;
				}
			}
		}
开发者ID:timonela,项目名称:mb-unit,代码行数:53,代码来源:CommandLineArgumentParser.cs

示例15: MainWindow

        public MainWindow()
        {
            InitializeComponent();

            var userInterface = new NormalWpfUserInterface();
            var settings = new DefaultSettings { HandleProcessCorruptedStateExceptions = true, UserInterface = userInterface };
            settings.Sender = new LocalSender();
            //Adding screenshot plugin
            settings.Plugins.Add(new ScreenShotWriter());
            var reporter = new ErrorReporter(settings);
            reporter.HandleExceptions = true;

            AppDomain.CurrentDomain.UnhandledException += reporter.UnhandledException;
            TaskScheduler.UnobservedTaskException += reporter.UnobservedTaskException;
            Application.Current.DispatcherUnhandledException += reporter.DispatcherUnhandledException;
        }
开发者ID:mgnslndh,项目名称:NCrash,代码行数:16,代码来源:MainWindow.xaml.cs


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