Beispiel #1
0
 public EmbeddingContext(
     CSharpCompilation compilation,
     CSharpParseOptions parseOptions,
     IDiagnosticReporter reporter,
     EmbedderConfig config,
     CancellationToken cancellationToken = default)
 {
     Compilation       = compilation;
     ParseOptions      = parseOptions;
     Reporter          = reporter;
     Config            = config;
     CancellationToken = cancellationToken;
 }
        public EmbeddingResolver(
            CSharpCompilation compilation,
            CSharpParseOptions parseOptions,
            IDiagnosticReporter reporter,
            EmbedderConfig config,
            CancellationToken cancellationToken = default)
        {
            var specificDiagnosticOptions = new Dictionary <string, ReportDiagnostic>
            {
                { "CS8019", ReportDiagnostic.Warn },
                { "CS0105", ReportDiagnostic.Warn },
            };
            var opts = compilation.Options
                       .WithSpecificDiagnosticOptions(specificDiagnosticOptions);

            this.ConcurrentBuild   = opts.ConcurrentBuild;
            this.parseOptions      = parseOptions.WithDocumentationMode(DocumentationMode.Diagnose);
            this.compilation       = compilation.WithOptions(opts);
            this.reporter          = reporter;
            this.config            = config;
            this.cancellationToken = cancellationToken;
        }