本文整理汇总了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;
}
示例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);
}
}