Beispiel #1
0
 public Service(IDocumentationProviderService documentationService)
 {
     _metadataCache = new MetadataReferenceCache(
         (path, properties) =>
         MetadataReference.CreateFromFile(
             path,
             properties,
             documentationService.GetDocumentationProvider(path)
             )
         );
 }
        private PortableExecutableReference ReadPortableExecutableReferenceFrom(ObjectReader reader, CancellationToken cancellationToken)
        {
            var kind = (SerializationKinds)reader.ReadInt32();

            if (kind == SerializationKinds.Bits || kind == SerializationKinds.MemoryMapFile)
            {
                var properties = ReadMetadataReferencePropertiesFrom(reader, cancellationToken);

                var filePath = reader.ReadString();

                var tuple = TryReadMetadataFrom(reader, kind, cancellationToken);
                if (tuple == null)
                {
                    // TODO: deal with xml document provider properly
                    //       should we shadow copy xml doc comment?

                    // image doesn't exist
                    return(new MissingMetadataReference(properties, filePath, XmlDocumentationProvider.Default));
                }

                // for now, we will use IDocumentationProviderService to get DocumentationProvider for metadata
                // references. if the service is not available, then use Default (NoOp) provider.
                // since xml doc comment is not part of solution snapshot, (like xml reference resolver or strong name
                // provider) this provider can also potentially provide content that is different than one in the host.
                // an alternative approach of this is synching content of xml doc comment to remote host as well
                // so that we can put xml doc comment as part of snapshot. but until we believe that is necessary,
                // it will go with simpler approach
                var documentProvider = filePath != null && _documentationService != null?
                                       _documentationService.GetDocumentationProvider(filePath) : XmlDocumentationProvider.Default;

                return(new SerializedMetadataReference(
                           properties, filePath, tuple.Value.metadata, tuple.Value.storages, documentProvider));
            }

            throw ExceptionUtilities.UnexpectedValue(kind);
        }
Beispiel #3
0
 public MetadataReference CreateMetadataReference(string location)
 {
     return(MetadataReference.CreateFromFile(location,
                                             documentation: _documentationProviderService.GetDocumentationProvider(location)));
 }
Beispiel #4
0
 public PortableExecutableReference GetReference(string resolvedPath, MetadataReferenceProperties properties)
 {
     return(MetadataReference.CreateFromFile(resolvedPath, properties, _documentationService.GetDocumentationProvider(resolvedPath)));
 }
 public Service(IDocumentationProviderService documentationService)
 {
     _provider = new Provider(this);
     _metadataCache = new MetadataReferenceCache((path, properties) =>
         MetadataReference.CreateFromFile(path, properties, documentationService.GetDocumentationProvider(path)));
 }