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


C# BuildErrorEventArgs.GetType方法代码示例

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


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

示例1: BuildMessage

 public BuildMessage(BuildErrorEventArgs args)
 {
     EventType = args.GetType().Name.Replace("EventArgs", "");
     Code = args.Code;
     ColumnNumber = args.ColumnNumber;
     EndColumnNumber = args.EndColumnNumber;
     EndLineNumber = args.EndLineNumber;
     File = args.File;
     LineNumber = args.LineNumber;
     Message = args.Message;
     ProjectFile = args.ProjectFile;
     Subcategory = args.Subcategory;
     HelpKeyword = args.HelpKeyword;
     SenderName = args.SenderName;
     Timestamp = args.Timestamp;
     ThreadId = args.ThreadId;
 }
开发者ID:perpetual-motion,项目名称:clrplus,代码行数:17,代码来源:Logger.cs

示例2: LogErrorEvent

        /// <summary>
        /// Stub implementation -- forwards to engine being proxied.
        /// </summary>
        public void LogErrorEvent(BuildErrorEventArgs e)
        {
            ErrorUtilities.VerifyThrowArgumentNull(e, "e");
            ErrorUtilities.VerifyThrowInvalidOperation(activeProxy == true, "AttemptingToLogFromInactiveTask");

            if (parentModule.IsRunningMultipleNodes && !e.GetType().IsSerializable)
            {
                loggingServices.LogWarning(buildEventContext, new BuildEventFileInfo(string.Empty), "ExpectedEventToBeSerializable", e.GetType().Name);
                return;
            }

            string message = GetUpdatedMessage(e.File, e.Message, parentProjectFullFileName);

            if (ContinueOnError)
            {
                // Convert the error into a warning.  We do this because the whole point of 
                // ContinueOnError is that a project author expects that the task might fail,
                // but wants to ignore the failures.  This implies that we shouldn't be logging
                // errors either, because you should never have a successful build with errors.
                BuildWarningEventArgs warningEvent = new BuildWarningEventArgs
                        (   e.Subcategory,
                            e.Code,
                            e.File,
                            e.LineNumber,
                            e.ColumnNumber,
                            e.EndLineNumber,
                            e.EndColumnNumber,
                            message,  // this is the new message from above
                            e.HelpKeyword,
                            e.SenderName);

                warningEvent.BuildEventContext = buildEventContext;
                loggingServices.LogWarningEvent(warningEvent);

                // Log a message explaining why we converted the previous error into a warning.
                loggingServices.LogComment(buildEventContext,MessageImportance.Normal, "ErrorConvertedIntoWarning");
            }
            else
            {
                if(e.GetType().Equals(BuildErrorEventArgsType))
                {
                    // We'd like to add the project file to the subcategory, but since this property
                    // is read-only on the BuildErrorEventArgs type, this requires creating a new
                    // instance.  However, if some task logged a custom error type, we don't want to
                    // impolitely (as we already do above on ContinueOnError) throw the custom type
                    // data away.
                    e = new BuildErrorEventArgs
                        (
                            e.Subcategory,
                            e.Code, 
                            e.File, 
                            e.LineNumber, 
                            e.ColumnNumber, 
                            e.EndLineNumber, 
                            e.EndColumnNumber, 
                            message,  // this is the new message from above
                            e.HelpKeyword, 
                            e.SenderName
                        );
                }

                e.BuildEventContext = buildEventContext;
                loggingServices.LogErrorEvent(e);
            }
        }
开发者ID:nikson,项目名称:msbuild,代码行数:68,代码来源:EngineProxy.cs


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