|
8 | 8 | using System.Diagnostics.CodeAnalysis;
|
9 | 9 | using System.IO;
|
10 | 10 | using System.Reflection.Metadata;
|
| 11 | +using System.Threading; |
11 | 12 | using Microsoft.CodeAnalysis.Diagnostics;
|
12 | 13 | using Microsoft.CodeAnalysis.Host;
|
13 | 14 | using Microsoft.CodeAnalysis.Shared.Extensions;
|
@@ -53,24 +54,15 @@ private static Checksum CreateChecksum(MetadataReference reference)
|
53 | 54 |
|
54 | 55 | protected virtual Checksum CreateChecksum(AnalyzerReference reference)
|
55 | 56 | {
|
56 |
| -#if NET |
57 |
| - // If we're in the oop side and we're being asked to produce our local checksum (so we can compare it to the |
58 |
| - // host checksum), then we want to just defer to the underlying analyzer reference of our isolated reference. |
59 |
| - // This underlying reference corresponds to the reference that the host has, and we do not want to make any |
60 |
| - // changes as long as they're both in agreement. |
61 |
| - if (reference is IsolatedAnalyzerFileReference { UnderlyingAnalyzerFileReference: var underlyingReference }) |
62 |
| - reference = underlyingReference; |
63 |
| -#endif |
64 |
| - |
65 | 57 | using var stream = SerializableBytes.CreateWritableStream();
|
66 | 58 |
|
67 | 59 | using (var writer = new ObjectWriter(stream, leaveOpen: true))
|
68 | 60 | {
|
69 | 61 | switch (reference)
|
70 | 62 | {
|
71 |
| - case AnalyzerFileReference fileReference: |
72 |
| - writer.WriteString(fileReference.FullPath); |
73 |
| - writer.WriteGuid(TryGetAnalyzerFileReferenceMvid(fileReference)); |
| 63 | + case AnalyzerFileReference file: |
| 64 | + writer.WriteString(file.FullPath); |
| 65 | + writer.WriteGuid(TryGetAnalyzerFileReferenceMvid(file)); |
74 | 66 | break;
|
75 | 67 |
|
76 | 68 | case AnalyzerImageReference analyzerImageReference:
|
@@ -117,11 +109,11 @@ protected virtual void WriteAnalyzerReferenceTo(AnalyzerReference reference, Obj
|
117 | 109 | {
|
118 | 110 | switch (reference)
|
119 | 111 | {
|
120 |
| - case AnalyzerFileReference fileReference: |
| 112 | + case AnalyzerFileReference file: |
121 | 113 | writer.WriteString(nameof(AnalyzerFileReference));
|
122 |
| - writer.WriteString(fileReference.FullPath); |
| 114 | + writer.WriteString(file.FullPath); |
123 | 115 |
|
124 |
| - // Note: it is intentional that we are not writing the MVID of the analyzer file reference over in (even |
| 116 | + // Note: it is intentional that we are not writing the MVID of the analyzer file reference over (even |
125 | 117 | // though we mixed it into the checksum). We don't actually need the data on the other side as it will
|
126 | 118 | // be read out from the file itself. So the flow is as follows when an analyzer-file-reference changes:
|
127 | 119 | //
|
@@ -158,10 +150,8 @@ protected virtual AnalyzerReference ReadAnalyzerReferenceFrom(ObjectReader reade
|
158 | 150 | switch (reader.ReadString())
|
159 | 151 | {
|
160 | 152 | case nameof(AnalyzerFileReference):
|
161 |
| - // Rehydrate the analyzer file reference with the simple shared shadow copy loader. Note: we won't |
162 |
| - // actually use this instance we create. Instead, the caller will use create an IsolatedAssemblyReferenceSet |
163 |
| - // from these to ensure that all the types can be safely loaded into their own ALC. |
164 |
| - return new AnalyzerFileReference(reader.ReadRequiredString(), _analyzerLoaderProvider.SharedShadowCopyLoader); |
| 153 | + var fullPath = reader.ReadRequiredString(); |
| 154 | + return new AnalyzerFileReference(fullPath, _analyzerLoaderProvider.SharedShadowCopyLoader); |
165 | 155 |
|
166 | 156 | case nameof(AnalyzerImageReference):
|
167 | 157 | var guid = reader.ReadGuid();
|
@@ -296,7 +286,7 @@ private PortableExecutableReference ReadPortableExecutableReferenceFrom(ObjectRe
|
296 | 286 | // so that we can put xml doc comment as part of snapshot. but until we believe that is necessary,
|
297 | 287 | // it will go with simpler approach
|
298 | 288 | var documentProvider = filePath != null && _documentationService != null ?
|
299 |
| - _documentationService.GetDocumentationProvider(filePath) : DocumentationProvider.Default; |
| 289 | + _documentationService.GetDocumentationProvider(filePath) : XmlDocumentationProvider.Default; |
300 | 290 |
|
301 | 291 | return new SerializedPortableExecutableReference(
|
302 | 292 | properties, filePath, metadata, storageHandles, documentProvider);
|
|
0 commit comments