public void addMessage(DiagnosticMessage message)
 {
     lock (messageLocker)
     {
         messages.Add(message);
     }
 }
Beispiel #2
0
        private static List <DiagnosticMessage> ValueAsCompilationMessages(JsonObject obj, string key)
        {
            var messages = new List <DiagnosticMessage>();

            var arrayValue = obj.Value(key) as JsonArray;

            for (int i = 0; i < arrayValue.Length; i++)
            {
                var item = arrayValue[i] as JsonObject;

                var message = new DiagnosticMessage(
                    item.ValueAsString(nameof(DiagnosticMessage.Message)),
                    item.ValueAsString(nameof(DiagnosticMessage.FormattedMessage)),
                    item.ValueAsString(nameof(DiagnosticMessage.SourceFilePath)),
                    (DiagnosticMessageSeverity)item.ValueAsInt(nameof(DiagnosticMessage.Severity)),
                    item.ValueAsInt(nameof(DiagnosticMessage.StartColumn)),
                    item.ValueAsInt(nameof(DiagnosticMessage.StartLine)),
                    item.ValueAsInt(nameof(DiagnosticMessage.EndColumn)),
                    item.ValueAsInt(nameof(DiagnosticMessage.EndLine)));

                messages.Add(message);
            }

            return(messages);
        }
        static DiagnosticMessage MakeInternal(DiagnosticType type, string errorCode, string messageData, MethodDefinition method, Instruction instruction)
        {
            var result = new DiagnosticMessage {
                Column = 0, Line = 0, DiagnosticType = type, File = ""
            };

            var seq = instruction != null?CecilHelpers.FindBestSequencePointFor(method, instruction) : null;

            if (errorCode.Contains("ICE"))
            {
                messageData = messageData + " Seeing this error indicates a bug in the dots compiler. We'd appreciate a bug report (About->Report a Bug...). Thnx! <3";
            }

            var errorType = type == DiagnosticType.Error ? "error" : "warning";

            messageData = $"{errorType} {errorCode}: {messageData}";
            if (seq != null)
            {
                result.File   = seq.Document.Url;
                result.Column = seq.StartColumn;
                result.Line   = seq.StartLine;
#if !UNITY_DOTSRUNTIME
                var shortenedFilePath = seq.Document.Url.Replace($"{Environment.CurrentDirectory}{Path.DirectorySeparatorChar}", "");
                result.MessageData = $"{shortenedFilePath}({seq.StartLine},{seq.StartColumn}): {messageData}";
#else
                result.MessageData = messageData;
#endif
            }
            else
            {
                result.MessageData = messageData;
            }

            return(result);
        }
        public static DiagnosticMessage MakeError(string errorCode, string messageData, MethodDefinition method, Instruction instruction)
        {
            var result = new DiagnosticMessage {
                Column = 0, Line = 0, DiagnosticType = DiagnosticType.Error, File = ""
            };

            var seq = instruction != null?CecilHelpers.FindBestSequencePointFor(method, instruction) : null;

            if (errorCode.Contains("ICE"))
            {
                messageData = messageData + " Seeing this error indicates a bug in the dots compiler. We'd appreciate a bug report (About->Report a Problem). Thnx! <3";
            }

            messageData = $"error {errorCode}: {messageData}";
            if (seq != null)
            {
                result.File        = seq.Document.Url;
                result.Column      = seq.StartColumn;
                result.Line        = seq.StartLine;
                result.MessageData = $"{seq.Document.Url}:({seq.StartLine},{seq.StartColumn}) {messageData}";
            }
            else
            {
                result.MessageData = messageData;
            }

            return(result);
        }
Beispiel #5
0
        private static DiagnosticMessage MakeInternal(DiagnosticType type, string errorCode, string messageData,
                                                      MethodDefinition method, Instruction instruction)
        {
            var result = new DiagnosticMessage {
                Column = 0, Line = 0, DiagnosticType = type, File = ""
            };

            var seq = method != null?Helpers.FindBestSequencePointFor(method, instruction) : null;

            messageData = $"error {errorCode}: {messageData}";
            if (seq != null)
            {
                result.File   = seq.Document.Url;
                result.Column = seq.StartColumn;
                result.Line   = seq.StartLine;
#if UNITY_EDITOR
                result.MessageData = $"{seq.Document.Url}({seq.StartLine},{seq.StartColumn}): {messageData}";
#else
                result.MessageData = messageData;
#endif
            }
            else
            {
                result.MessageData = messageData;
            }

            return(result);
        }
Beispiel #6
0
        private static DiagnosticMessage Make(DiagnosticType type, string errorCode, string messageData,
                                              SequencePoint seq)
        {
            var result = new DiagnosticMessage {
                Column = 0, Line = 0, DiagnosticType = type, File = ""
            };

            messageData = $"error {errorCode}: {messageData}";
            if (seq != null)
            {
                result.File   = seq.Document.Url;
                result.Column = seq.StartColumn;
                result.Line   = seq.StartLine;
#if UNITY_EDITOR
                result.MessageData = $"{seq.Document.Url}({seq.StartLine},{seq.StartColumn}): {messageData}";
#else
                result.MessageData = messageData;
#endif
            }
            else
            {
                result.MessageData = messageData;
            }

            return(result);
        }
Beispiel #7
0
 public QmlDiagnosticsTag(ITextSnapshot snapshot, DiagnosticMessage diagnosticMessage)
 {
     DiagnosticMessage = diagnosticMessage;
     Span = snapshot.CreateTrackingSpan(
         diagnosticMessage.Location.Offset, diagnosticMessage.Location.Length,
         SpanTrackingMode.EdgeExclusive);
 }
 public RecordEntry(DiagnosticMessage message, double width, double height, Action <DiagnosticMessage> ClearMethod)
 {
     Width            = width;
     Height           = height;
     this.ClearMethod = ClearMethod;
     this.message     = message;
     AddColumns();
 }
 ///-------------------------------------------------------------------------------------------------
 /// <summary>
 ///  Configure the constraint from a diagnostic message properties.
 /// </summary>
 /// <param name="message">
 ///  A diagnostic message
 /// </param>
 /// <returns>
 ///  A ConstraintBuilder&lt;T&gt;
 /// </returns>
 ///-------------------------------------------------------------------------------------------------
 public ConstraintBuilder <T> Message(DiagnosticMessage message)
 {
     Contract.Requires(message, "message");
     this._message   = message.Message;
     this._isWarning = message.MessageType == MessageType.Warning;
     this._category  = message.Category;
     return(this);
 }
 public static void Throw(this DiagnosticMessage dm)
 {
     if (dm.DiagnosticType != DiagnosticType.Error)
     {
         throw new InvalidOperationException("We should never throw exceptions for non-error Entities.ForEach diagnostic messages.");
     }
     throw new FoundErrorInUserCodeException(new[] { dm });
 }
 private void Log(DiagnosticMessage diagnosticMessage)
 {
     if (diagnosticMessage == null)
     {
         throw new ArgumentNullException(nameof(diagnosticMessage));
     }
     _diagnostics.Add(diagnosticMessage);
 }
Beispiel #12
0
        public IEnumerable <TTestCase> OrderTestCases <TTestCase>(IEnumerable <TTestCase> testCases)
            where TTestCase : ITestCase
        {
            var result  = testCases.ToList(); // Run them in discovery order
            var message = new DiagnosticMessage("Ordered {0} test cases", result.Count);

            diagnosticMessageSink.OnMessage(message);
            return(result);
        }
Beispiel #13
0
        public void AddGlobalDiagnostics(DiagnosticMessage message)
        {
            if (_diagnostics == null)
            {
                _diagnostics = new List<DiagnosticMessage>();
            }

            _diagnostics.Add(message);
        }
        public ILPostProcessResult PostProcessInternal(ICompiledAssembly compiledAssembly)
        {
            AssemblyDefinition assemblyDefinition;

#if MEDICINE_IL_DEBUG
            using (NonAlloc.Benchmark.Start($"GetAssemblyDefinition ({compiledAssembly.Name})"))
#endif
            assemblyDefinition = PostProcessorAssemblyResolver.GetAssemblyDefinitionFor(compiledAssembly);

            try
            {
                CecilExtensions.CurrentModule = assemblyDefinition.MainModule;
                PostProcessorContext context;
#if MEDICINE_IL_DEBUG
                using (NonAlloc.Benchmark.Start($"CreatePostProcessorContext ({compiledAssembly.Name})"))
#endif
                context = new PostProcessorContext(assemblyDefinition.MainModule);

#if MEDICINE_IL_DEBUG
                using (NonAlloc.Benchmark.Start($"MedicineInjection ({compiledAssembly.Name})"))
#endif
                new InjectionPostProcessor(context).ProcessAssembly();

                var pe  = new MemoryStream(capacity: 1024 * 64);
                var pdb = new MemoryStream(capacity: 1024 * 16);

                var writerParameters = new WriterParameters
                {
                    SymbolWriterProvider = new PortablePdbWriterProvider(),
                    SymbolStream         = pdb,
                    WriteSymbols         = true,
                };

                assemblyDefinition.Write(pe, writerParameters);
                var inMemoryAssembly = new InMemoryAssembly(pe.ToArray(), pdb.ToArray());

                return(new ILPostProcessResult(inMemoryAssembly, context.DiagnosticMessages));
            }
            catch (Exception ex)
            {
                var error = new DiagnosticMessage
                {
                    MessageData    = $"Unexpected exception while post-processing assembly {compiledAssembly.Name}:\n{ex}",
                    DiagnosticType = DiagnosticType.Error,
                };
                return(new ILPostProcessResult(compiledAssembly.InMemoryAssembly, new List <DiagnosticMessage> {
                    error
                }));
            }
            finally
            {
                CecilExtensions.CurrentModule.Dispose();
                CecilExtensions.CurrentModule = null;
            }
        }
Beispiel #15
0
 internal override void SetProtocolOp(Asn1ProtocolOp op)
 {
     op.BindResponse = new Asn1BindResponse
     {
         ResultCode        = ResultCode,
         MatchedDN         = MatchedDN.GetBytes(),
         DiagnosticMessage = DiagnosticMessage.LdapString(),
         Referral          = this.GetReferrals(Referrals),
         ServerSaslCreds   = ServerSaslCreds
     };
 }
        internal override void SetProtocolOp(Asn1ProtocolOp op)
        {
            var asn = new Asn1LDAPResult
            {
                ResultCode        = ResultCode,
                MatchedDN         = MatchedDN.GetBytes(),
                DiagnosticMessage = DiagnosticMessage.LdapString(),
                Referral          = this.GetReferrals(Referrals),
            };

            SetProtocolOp(op, asn);
        }
 private void AddLogEntry(DiagnosticMessage record)
 {
     DiagnosticRecords.Add(new DiagnosticLogRecord()
     {
         Source    = record.SourceString,
         Type      = record.TypeString,
         MID       = record.MidString,
         Component = record.Component,
         Mode      = record.FmiString,
         Date      = record.TimeStamp.ToString("MM/dd/yyyy HH:mm:ss tt"),
     });
 }
        private IObservable <Unit> ProcessQueue(IEnumerable <string> filePaths)
        {
            return(Observable.FromAsync(async() =>
            {
                var results = await Task.WhenAll(filePaths.Distinct().Select(ProcessNextItem));
                var message = new DiagnosticMessage()
                {
                    Results = results
                };

                _forwarder.Forward(message);
            }));
        }
Beispiel #19
0
        protected override async Task <Tuple <decimal, string> > InvokeTestAsync(ExceptionAggregator aggregator)
        {
            BenchmarkEventSource.Log.BenchmarkStart(this.DisplayName, TestCase.Iterations);

            //inject ITracer instance if test method defines single parameter of type ITracer
            var testMethodParams = TestMethod.GetParameters();
            var hasTracerParam   = (testMethodParams.Length == 1 && testMethodParams[0].ParameterType == typeof(ITracer));
            var args             = hasTracerParam  ? new object[] { NullTracer.Instance } : null;

            //run the test once to make sure it's been jitted
            await new BenchmarkTestInvoker(Test, MessageBus, TestClass, ConstructorArguments, TestMethod, args, aggregator, CancellationTokenSource).RunAsync();

            decimal executionTime = 0;

            //starting from 1 so that iteration number appears correctly in ETW log
            for (int i = 1; i <= TestCase.Iterations; i++)
            {
                if (TestCase.CollectGargage)
                {
                    GC.Collect();
                    GC.WaitForPendingFinalizers();
                    GC.Collect();
                }

                var stopwatchTracer = new StopwatchTracer();

                BenchmarkEventSource.Log.BenchmarkIterationStart(i);
                var invokerTime = await new BenchmarkTestInvoker(Test, MessageBus, TestClass, ConstructorArguments, TestMethod, hasTracerParam ? new object[] { stopwatchTracer } : null, aggregator, CancellationTokenSource).RunAsync();
                BenchmarkEventSource.Log.BenchmarkIterationStop(i);

                var stopwatchTime = stopwatchTracer.GetElapsed();

                if (stopwatchTime.HasValue)
                {
                    executionTime += stopwatchTime.Value;
                }
                else
                {
                    executionTime += invokerTime;
                }
            }

            var message = new DiagnosticMessage("{0} , Iterations : {1} , TotalMilliseconds : {2}", this.DisplayName, TestCase.Iterations, executionTime * 1000);

            diagnosticMessageSink.OnMessage(message);

            BenchmarkEventSource.Log.BenchmarkStop(this.DisplayName, TestCase.Iterations);
            return(Tuple.Create(executionTime, string.Empty));
        }
Beispiel #20
0
 internal override void SetProtocolOp(Asn1ProtocolOp op)
 {
     op.ExtendedResponse = new Asn1ExtendedResponse
     {
         ResultCode        = ResultCode,
         MatchedDN         = MatchedDN.GetBytes(),
         DiagnosticMessage = DiagnosticMessage.LdapString(),
         Referral          = this.GetReferrals(Referrals),
         Value             = Value
     };
     if (Name != null)
     {
         op.ExtendedResponse.Name = Name.NumericOid();
     }
 }
        private static void ConfigureFunctionLogging(IMessageSink sink, Process funcHostProcess)
        {
            void LogToOutput(object sender, DataReceivedEventArgs args)
            {
                var message = new DiagnosticMessage(args.Data);

                sink.OnMessage(message);
            }

            funcHostProcess.ErrorDataReceived  += LogToOutput;
            funcHostProcess.OutputDataReceived += LogToOutput;

            funcHostProcess.BeginOutputReadLine();
            funcHostProcess.BeginErrorReadLine();
        }
        void IActionFilter.OnActionExecuting(ActionExecutingContext filterContext)
        {
            // Log Action Filter Call
            var message = new DiagnosticMessage
            {
                IP       = filterContext.HttpContext.Request.UserHostAddress.ToString(),
                OrgId    = 75,
                PersonId = 3,
                Session  = "Session descipton"
            };

            LoggerFactory.CreateLog().Debug(message.MessageFormat, message.Parameters);

            this.OnActionExecuting(filterContext);
        }
        protected override void AssertProducesInternal(Type systemType, DiagnosticType expectedDiagnosticType, string[] errorIdentifiers, bool useFailResolver = false)
        {
            DiagnosticMessage error = null;

            try
            {
                AuthoringComponentPostProcessor.CreateBufferElementDataAuthoringType(TypeDefinitionFor(systemType));
            }
            catch (FoundErrorInUserCodeException exception)
            {
                error = exception.DiagnosticMessages.Single();
            }

            Assert.AreEqual(expected: expectedDiagnosticType, actual: error?.DiagnosticType);
            Assert.IsTrue(error?.MessageData.Contains(errorIdentifiers.Single()));
        }
        private async Task Dequeue()
        {
            var tasks = new List <Task <DiagnosticResult> >();

            for (var i = 0; i < 50; i++)
            {
                if (_openDocuments.IsEmpty)
                {
                    break;
                }
                string filePath = null;
                if (_openDocuments.TryDequeue(out filePath))
                {
                    tasks.Add(this.ProcessNextItem(filePath));
                }
            }

            if (!tasks.Any())
            {
                return;
            }

            var diagnosticResults = await Task.WhenAll(tasks.ToArray());

            if (diagnosticResults.Any())
            {
                var message = new DiagnosticMessage()
                {
                    Results = diagnosticResults
                };

                this._forwarder.Forward(message);
            }

            if (_openDocuments.IsEmpty)
            {
                lock (_lock)
                {
                    _queueRunning = false;
                }
            }
            else
            {
                this.ProcessQueue();
            }
        }
Beispiel #25
0
        public DiagnosticMessage ToDiagnosticMessage(MethodDefinition context)
        {
            var result = new DiagnosticMessage()
            {
                DiagnosticType = DiagnosticType.Error,
                MessageData    = MessageWithoutLocation,
            };

            var seq = SequencePointFor(context);

            if (seq != null)
            {
                result.Column = seq.StartColumn;
                result.Line   = seq.StartLine;
            }
            return(result);
        }
Beispiel #26
0
        private static void PrintDiagnostic(DiagnosticMessage diag)
        {
            switch (diag.Severity)
            {
            case DiagnosticMessageSeverity.Info:
                Reporter.Error.WriteLine(diag.FormattedMessage);
                break;

            case DiagnosticMessageSeverity.Warning:
                Reporter.Error.WriteLine(diag.FormattedMessage.Yellow().Bold());
                break;

            case DiagnosticMessageSeverity.Error:
                Reporter.Error.WriteLine(diag.FormattedMessage.Red().Bold());
                break;
            }
        }
        public async void TestRunBackgroundWorker()
        {
            var platformServicesFake = A.Fake <IPlatformServices>();

            Device.PlatformServices = platformServicesFake;

            DatabaseMigrator.Migrate(_connection, _migrationSkriptFolderPath);


            MessagingCenter.Subscribe <StartBackgroundWorkingServiceMessage>(this, MessageHelper.START_BACKGROUND_WORKING_SERVICE_MESSAGE, message =>
            {
                var msg = new DiagnosticMessage("Start Background Working Service");
                output.WriteLine("{0}", msg.Message);
            });

            MessagingCenter.Subscribe <StopBackgroundWorkingServiceMessage>(this, MessageHelper.STOP_BACKGROUND_WORKING_SERVICE_MESSAGE, message =>
            {
                var msg = new DiagnosticMessage("Stop Background Working Service");
                output.WriteLine("{0}", msg.Message);
            });

            MessagingCenter.Subscribe <ElementFinishedMessage>(this, MessageHelper.ELEMENT_FINISHED_MESSAGE, message =>
            {
                var msg = new DiagnosticMessage("Element processed");
                output.WriteLine("{0}", msg.Message);
            });

            var deleteAll = BackgroundQueueService.EmptyQueue(_connection).Result;

            Assert.True(deleteAll);

            var testSpotGuid = Guid.NewGuid();
            var testLat      = 48.45;
            var testLng      = 13.9167;

            var result = BackgroundQueueService.PushWheaterRequestToBackgroundQueue(_connection, testSpotGuid, testLat, testLng).Result;

            Assert.True(result != Guid.Empty);

            await BackgroundWorkerService.RunBackgroundWorkerService(_connection, new CancellationToken(false));

            int cnt = BackgroundQueueService.GetQueueElementCount(_connection).Result;

            Assert.Equal(0, cnt);
        }
        public Process StartFunction(IConfigurationRoot config, IMessageSink sink)
        {
            var dotnetExePath     = Environment.ExpandEnvironmentVariables(config["DotnetExecutablePath"]);
            var functionHostPath  = Environment.ExpandEnvironmentVariables(config["FunctionHostPath"]);
            var functionAppFolder = config["FunctionApplicationPath"];

            var configMessage = new DiagnosticMessage("DotnetExePath: {0}, FunctionHostPath: {1}, FunctionApplicationPath: {2}",
                                                      dotnetExePath, functionHostPath, functionAppFolder);

            sink.OnMessage(configMessage);

            var funcHostProcess = new Process
            {
                StartInfo =
                {
                    FileName               = dotnetExePath,
                    Arguments              = $"\"{functionHostPath}\" start -p {Port} --csharp",
                    WorkingDirectory       = functionAppFolder,
                    RedirectStandardError  = true,
                    RedirectStandardOutput = true,
                }
            };

            var success = funcHostProcess.Start();

            if (!success)
            {
                throw new InvalidOperationException("Could not start Azure Functions host.");
            }

            ConfigureFunctionLogging(sink, funcHostProcess);

            if (funcHostProcess.HasExited)
            {
                var error = _funcHostProcess.StandardError.ReadToEnd();
                throw new InvalidOperationException(error);
            }

            // ugly hack to let azure function start before test begun
            Thread.Sleep(200);

            return(funcHostProcess);
        }
Beispiel #29
0
        public virtual Task <IEnumerable <DiagnosticMessage> > GetDiagnosticMessages(CancellationToken cancellationToken)
        {
            List <DiagnosticMessage> diagnosticMessages = new List <DiagnosticMessage>();

            foreach (SettingInfo info in _settings.Values)
            {
                string errorMessage = (string)info.CheckErrorMethod.Invoke(info.Setting, Array.Empty <object>());

                if (string.IsNullOrEmpty(errorMessage))
                {
                    continue;
                }

                DiagnosticMessage diagnosticMessage = new DiagnosticMessage(Severity.Error, errorMessage);
                diagnosticMessages.Add(diagnosticMessage);
            }

            return(Task.FromResult((IEnumerable <DiagnosticMessage>)diagnosticMessages));
        }
Beispiel #30
0
        protected override void AssertProducesInternal(
            Type systemType,
            DiagnosticType expectedDiagnosticType,
            string[] errorIdentifiers,
            bool useFailResolver = false)
        {
            DiagnosticMessage error = null;

            try
            {
                AssemblyDefinition assemblyDefinition   = AssemblyDefinition.ReadAssembly(systemType.Assembly.Location);
                TypeDefinition     typeDefinitionToTest = assemblyDefinition.MainModule.Types.Single(t => t.Name == systemType.Name);

                bool _ = AuthoringComponentPostProcessor.RunTest(typeDefinitionToTest);
            }
            catch (FoundErrorInUserCodeException exception)
            {
                error = exception.DiagnosticMessages.Single();
            }
            Assert.AreEqual(expected: expectedDiagnosticType, actual: error?.DiagnosticType);
            Assert.IsTrue(error?.MessageData.Contains(errorIdentifiers.Single()));
        }
        public DiagnosticMessageView(DiagnosticMessage data)
        {
            ErrorCode = data.ErrorCode;
            SourceFilePath = data.SourceFilePath;
            Message = data.Message;
            Severity = data.Severity;
            StartLine = data.StartLine;
            StartColumn = data.StartColumn;
            EndLine = data.EndLine;
            EndColumn = data.EndColumn;
            FormattedMessage = data.FormattedMessage;

            var description = data.Source as LibraryDescription;
            if (description != null)
            {
                Source = new
                {
                    Name = description.Identity.Name,
                    Version = description.Identity.Version?.ToString()
                };
            }
        }
 private void AddRecord(DiagnosticMessage message)
 {
     if (numDisplayedRecords < maxDisplayedRecords)
     {
         if ((RecordEntries.Find(x => (x.message.ID == message.ID) && (x.message.Fmi == message.Fmi)) == null))
         {
             if (!inWarningMode)
             {
                 inWarningMode = true;
                 SetBackground();
             }
             var entry = new RecordEntry(message, canvas.Width, ((canvas.Height - (canvas.Height / (maxDisplayedRecords * 2))) / (double)maxDisplayedRecords), RemoveRecord)
             {
                 //Background = new SolidColorBrush(Colors.Blue),
             };
             RecordEntries.Add(entry);
             recordStack.Children.Add(entry);
             numDisplayedRecords++;
             //AdjustRecordHeight();
         }
     }
 }
Beispiel #33
0
        public DiagnosticMessageView(DiagnosticMessage data)
        {
            ErrorCode        = data.ErrorCode;
            SourceFilePath   = data.SourceFilePath;
            Message          = data.Message;
            Severity         = data.Severity;
            StartLine        = data.StartLine;
            StartColumn      = data.StartColumn;
            EndLine          = data.EndLine;
            EndColumn        = data.EndColumn;
            FormattedMessage = data.FormattedMessage;

            var description = data.Source as LibraryDescription;

            if (description != null)
            {
                Source = new
                {
                    Name    = description.Identity.Name,
                    Version = description.Identity.Version?.ToString()
                };
            }
        }
Beispiel #34
0
        private static List<DiagnosticMessage> ValueAsCompilationMessages(JsonObject obj, string key)
        {
            var messages = new List<DiagnosticMessage>();

            var arrayValue = obj.Value(key) as JsonArray;
            for (int i = 0; i < arrayValue.Length; i++)
            {
                var item = arrayValue[i] as JsonObject;

                var message = new DiagnosticMessage(
                    item.ValueAsString(nameof(DiagnosticMessage.ErrorCode)),
                    item.ValueAsString(nameof(DiagnosticMessage.Message)),
                    item.ValueAsString(nameof(DiagnosticMessage.FormattedMessage)),
                    item.ValueAsString(nameof(DiagnosticMessage.SourceFilePath)),
                    (DiagnosticMessageSeverity)item.ValueAsInt(nameof(DiagnosticMessage.Severity)),
                    item.ValueAsInt(nameof(DiagnosticMessage.StartColumn)),
                    item.ValueAsInt(nameof(DiagnosticMessage.StartLine)),
                    item.ValueAsInt(nameof(DiagnosticMessage.EndColumn)),
                    item.ValueAsInt(nameof(DiagnosticMessage.EndLine)));

                messages.Add(message);
            }

            return messages;
        }
        protected void addMessage(DiagnosticMessage m)
        {
            if (App.diagnosticWindow != null)
            {
                App.diagnosticWindow.Dispatcher.adopt(delegate
                {
                    lock (messageHistoryLock)
                    {
                        App.diagnosticWindow.messageSource.Add(m);
                    };
                });

            }
        }
Beispiel #36
0
 private static void PrintDiagnostic(DiagnosticMessage diag)
 {
     switch (diag.Severity)
     {
         case DiagnosticMessageSeverity.Info:
             Reporter.Error.WriteLine(diag.FormattedMessage);
             break;
         case DiagnosticMessageSeverity.Warning:
             Reporter.Error.WriteLine(diag.FormattedMessage.Yellow().Bold());
             break;
         case DiagnosticMessageSeverity.Error:
             Reporter.Error.WriteLine(diag.FormattedMessage.Red().Bold());
             break;
     }
 }