Ejemplo n.º 1
0
        /// <summary>
        /// Logs all parsing and local binding errors.
        /// </summary>
        private void ReportWorkspaceParsingAndBindingErrorsIfNeeded(Workspace workspace)
        {
            if (workspace == null || workspace.Succeeded || workspace.IsCanceled)
            {
                return;
            }

            // It is relatively hard to stop analysis when the error limit is reached.
            // For now, the limit is applied only on the error reporting stage.
            foreach (var error in workspace.GetAllParsingAndBindingErrors().Take(FrontEndConfiguration.ErrorLimit()))
            {
                ReportSyntaxError(error);
            }

            // TODO: current design is not good.
            // Consider following: we're getting 10 errors during workspace construction.
            // Next line will print just one error and all other will just sit in memory.

            // Then writing generic error message that workspace computation failed
            m_logger.CannotBuildWorkspace(LoggingContext, workspace.Failures.First().Describe());
        }
Ejemplo n.º 2
0
        private void LogWorkspaceSemanticErrors(ISemanticModel semanticModel)
        {
            // It is relatively hard to stop analysis when the error limit is reached.
            // For now, the limit is applied only on the error reporting stage.
            foreach (var semanticError in semanticModel.GetAllSemanticDiagnostics().Take(FrontEndConfiguration.ErrorLimit()))
            {
                ReportSemanticError(semanticError);
            }

            // Then writing generic error message that workspace computation failed
            m_logger.CannotBuildWorkspace(LoggingContext, "One or more error occurred during workspace analysis. See output for more details.");
        }