Exemple #1
0
 public BuildMessage(BuildWarningEventArgs 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;
 }
Exemple #2
0
        /// <summary>
        /// Stub implementation -- forwards to engine being proxied.
        /// </summary>
        public void LogWarningEvent(BuildWarningEventArgs 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;
            }

            if (e.GetType().Equals(BuildWarningEventArgsType))
            {
                // We'd like to add the project file to the message, but since this property
                // is read-only on the BuildWarningEventArgs type, this requires creating a new
                // instance.  However, if some task logged a custom warning type, we don't want 
                // to impolitely throw the custom type data away.

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

                e = 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
                );
            }

            e.BuildEventContext = buildEventContext;
            loggingServices.LogWarningEvent(e);
        }