本文整理汇总了C#中Microsoft.CodeAnalysis.TouchedFileLogger类的典型用法代码示例。如果您正苦于以下问题:C# TouchedFileLogger类的具体用法?C# TouchedFileLogger怎么用?C# TouchedFileLogger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TouchedFileLogger类属于Microsoft.CodeAnalysis命名空间,在下文中一共展示了TouchedFileLogger类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetExternalMetadataResolver
internal override MetadataFileReferenceResolver GetExternalMetadataResolver(TouchedFileLogger touchedFiles)
{
// We don't log touched files atm.
return new DesktopMetadataReferenceResolver(
new RelativePathReferenceResolver(Arguments.ReferencePaths, Arguments.BaseDirectory),
null,
new GacFileResolver(GacFileResolver.Default.Architectures, CultureInfo.CurrentCulture));
}
示例2: LoggingSourceFileResolver
public LoggingSourceFileResolver(
ImmutableArray<string> searchPaths,
string baseDirectory,
ImmutableArray<KeyValuePair<string, string>> pathMap,
TouchedFileLogger logger)
: base(searchPaths, baseDirectory, pathMap)
{
_loggerOpt = logger;
}
示例3: GetCommandLineMetadataReferenceResolver
internal override MetadataReferenceResolver GetCommandLineMetadataReferenceResolver(TouchedFileLogger loggerOpt)
{
return new RuntimeMetadataReferenceResolver(
new RelativePathResolver(Arguments.ReferencePaths, Arguments.BaseDirectory),
null,
new GacFileResolver(GacFileResolver.Default.Architectures, CultureInfo.CurrentCulture),
(path, properties) =>
{
loggerOpt?.AddRead(path);
return MetadataReference.CreateFromFile(path);
});
}
示例4: ExistingReferencesResolver
public ExistingReferencesResolver(
ImmutableArray<PortableExecutableReference> availableReferences,
ImmutableArray<string> referencePaths,
string baseDirectory,
AssemblyIdentityComparer assemblyIdentityComparer,
TouchedFileLogger logger)
: base(referencePaths, baseDirectory, logger)
{
Debug.Assert(!availableReferences.Any(r => r.Properties.Kind != MetadataImageKind.Assembly));
_availableReferences = availableReferences;
_assemblyIdentityComparer = assemblyIdentityComparer;
}
示例5: ResolveAnalyzersFromArguments
internal ImmutableArray<DiagnosticAnalyzer> ResolveAnalyzersFromArguments(string language, List<DiagnosticInfo> diagnostics, CommonMessageProvider messageProvider, TouchedFileLogger touchedFiles, IAnalyzerAssemblyLoader analyzerLoader)
{
var builder = ImmutableArray.CreateBuilder<DiagnosticAnalyzer>();
EventHandler<AnalyzerLoadFailureEventArgs> errorHandler = (o, e) =>
{
var analyzerReference = o as AnalyzerFileReference;
DiagnosticInfo diagnostic = null;
switch (e.ErrorCode)
{
case AnalyzerLoadFailureEventArgs.FailureErrorCode.UnableToLoadAnalyzer:
diagnostic = new DiagnosticInfo(messageProvider, messageProvider.WRN_UnableToLoadAnalyzer, analyzerReference.FullPath, e.Message);
break;
case AnalyzerLoadFailureEventArgs.FailureErrorCode.UnableToCreateAnalyzer:
diagnostic = new DiagnosticInfo(messageProvider, messageProvider.WRN_AnalyzerCannotBeCreated, e.TypeName, analyzerReference.FullPath, e.Message);
break;
case AnalyzerLoadFailureEventArgs.FailureErrorCode.NoAnalyzers:
diagnostic = new DiagnosticInfo(messageProvider, messageProvider.WRN_NoAnalyzerInAssembly, analyzerReference.FullPath);
break;
case AnalyzerLoadFailureEventArgs.FailureErrorCode.None:
default:
return;
}
// Filter this diagnostic based on the compilation options so that /nowarn and /warnaserror etc. take effect.
diagnostic = messageProvider.FilterDiagnosticInfo(diagnostic, this.CompilationOptions);
if (diagnostic != null)
{
diagnostics.Add(diagnostic);
}
};
foreach (var reference in AnalyzerReferences)
{
var resolvedReference = ResolveAnalyzerReference(reference, analyzerLoader);
if (resolvedReference != null)
{
resolvedReference.AnalyzerLoadFailed += errorHandler;
resolvedReference.AddAnalyzers(builder, language);
resolvedReference.AnalyzerLoadFailed -= errorHandler;
}
else
{
diagnostics.Add(new DiagnosticInfo(messageProvider, messageProvider.ERR_MetadataFileNotFound, reference.FilePath));
}
}
return builder.ToImmutable();
}
示例6: CreateCompilation
public abstract Compilation CreateCompilation(TextWriter consoleOutput, TouchedFileLogger touchedFilesLogger, ErrorLogger errorLogger);
示例7: GetExternalMetadataResolver
internal virtual MetadataFileReferenceResolver GetExternalMetadataResolver(TouchedFileLogger touchedFiles)
{
return CreateLoggingMetadataResolver(touchedFiles);
}
示例8: ResolveMetadataReferences
/// <summary>
/// Resolves metadata references stored in command line arguments and reports errors for those that can't be resolved.
/// </summary>
internal List<MetadataReference> ResolveMetadataReferences(
MetadataFileReferenceResolver externalReferenceResolver,
MetadataFileReferenceProvider metadataProvider,
List<DiagnosticInfo> diagnostics,
AssemblyIdentityComparer assemblyIdentityComparer,
TouchedFileLogger touchedFiles,
out MetadataFileReferenceResolver referenceDirectiveResolver)
{
List<MetadataReference> resolved = new List<MetadataReference>();
Arguments.ResolveMetadataReferences(new AssemblyReferenceResolver(externalReferenceResolver, metadataProvider), diagnostics, this.MessageProvider, resolved);
if (Arguments.IsInteractive)
{
referenceDirectiveResolver = externalReferenceResolver;
}
else
{
// when compiling into an assembly (csc/vbc) we only allow #r that match references given on command line:
referenceDirectiveResolver = new ExistingReferencesResolver(
CreateLoggingMetadataResolver(touchedFiles),
resolved.Where(r => r.Properties.Kind == MetadataImageKind.Assembly).OfType<PortableExecutableReference>().AsImmutable(),
assemblyIdentityComparer);
}
return resolved;
}
示例9: LoggingStrongNameProvider
public LoggingStrongNameProvider(ImmutableArray<string> keyFileSearchPaths, TouchedFileLogger logger, string tempPath)
: base(keyFileSearchPaths, tempPath)
{
_loggerOpt = logger;
}
示例10: CreateLoggingMetadataResolver
private MetadataFileReferenceResolver CreateLoggingMetadataResolver(TouchedFileLogger logger)
{
MetadataFileReferenceResolver resolver = new RelativePathReferenceResolver(Arguments.ReferencePaths, Arguments.BaseDirectory);
return (logger == null) ? resolver : new LoggingMetadataReferencesResolver(resolver, logger);
}
示例11: GetCommandLineMetadataReferenceResolver
internal virtual MetadataReferenceResolver GetCommandLineMetadataReferenceResolver(TouchedFileLogger loggerOpt)
{
var pathResolver = new RelativePathResolver(Arguments.ReferencePaths, Arguments.BaseDirectory);
return new LoggingMetadataFileReferenceResolver(pathResolver, GetMetadataProvider(), loggerOpt);
}
示例12: LoggingSourceFileResolver
public LoggingSourceFileResolver(ImmutableArray<string> searchPaths, string baseDirectory, TouchedFileLogger logger)
: base(searchPaths, baseDirectory)
{
_logger = logger;
}
示例13: ResolveAnalyzersFromArguments
protected abstract ImmutableArray<DiagnosticAnalyzer> ResolveAnalyzersFromArguments(List<DiagnosticInfo> diagnostics, CommonMessageProvider messageProvider, TouchedFileLogger touchedFiles);
示例14: ResolveMetadataReferences
/// <summary>
/// Resolves metadata references stored in command line arguments and reports errors for those that can't be resolved.
/// </summary>
internal List<MetadataReference> ResolveMetadataReferences(
MetadataReferenceResolver externalReferenceResolver,
MetadataReferenceProvider metadataProvider,
List<DiagnosticInfo> diagnostics,
AssemblyIdentityComparer assemblyIdentityComparer,
TouchedFileLogger touchedFiles,
out MetadataReferenceResolver referenceDirectiveResolver)
{
using (Logger.LogBlock(FunctionId.Common_CommandLineCompiler_ResolveMetadataReferences))
{
List<MetadataReference> resolved = new List<MetadataReference>();
ResolveMetadataReferencesFromArguments(externalReferenceResolver, metadataProvider, diagnostics, resolved);
if (Arguments.IsInteractive)
{
referenceDirectiveResolver = externalReferenceResolver;
}
else
{
// when compiling into an assembly (csc/vbc) we only allow #r that match references given on command line:
referenceDirectiveResolver = new ExistingReferencesResolver(
resolved.Where(r => r.Properties.Kind == MetadataImageKind.Assembly).OfType<MetadataFileReference>().AsImmutable(),
Arguments.ReferencePaths,
Arguments.BaseDirectory,
assemblyIdentityComparer,
touchedFiles);
}
return resolved;
}
}
示例15: CreateCompilation
protected abstract Compilation CreateCompilation(TextWriter consoleOutput, TouchedFileLogger touchedFilesLogger);