public void SlowSetup(MirrorSharpOptions options) { // ReSharper disable HeapView.ObjectAllocation.Evident // ReSharper disable HeapView.DelegateAllocation options.EnableVisualBasic(o => { // This setup will only run if the language is used, so branches // where no one ever used VB will be faster to open. var maxLanguageVersion = Enum.GetValues(typeof(LanguageVersion)).Cast <LanguageVersion>().Max(); o.ParseOptions = new VisualBasicParseOptions( maxLanguageVersion, documentationMode: DocumentationMode.Diagnose ); var referencedAssemblies = _referenceCollector.SlowGetAllReferencedAssembliesRecursive( // Essential NetFrameworkRuntime.AssemblyOfValueTuple, NetFrameworkRuntime.AssemblyOfValueTask, NetFrameworkRuntime.AssemblyOfSpan, typeof(StandardModuleAttribute).Assembly, // Runtime typeof(JitGenericAttribute).Assembly, // Requested typeof(XDocument).Assembly, // System.Xml.Linq typeof(HttpUtility).Assembly // System.Web ).ToImmutableList(); _assemblyReferenceDiscoveryTaskSource.Complete(referencedAssemblies.Select(a => a.Location).ToImmutableList()); o.MetadataReferences = referencedAssemblies .Select(a => (MetadataReference)MetadataReference.CreateFromFile(a.Location, documentation: _documentationResolver.GetDocumentation(a))) .ToImmutableList(); }); // ReSharper restore HeapView.DelegateAllocation // ReSharper restore HeapView.ObjectAllocation.Evident }
public void SlowApplyTo(MirrorSharpOptions options) { // ReSharper disable HeapView.ObjectAllocation.Evident // ReSharper disable HeapView.DelegateAllocation options.EnableVisualBasic(o => { // This setup will only run if the language is used, so branches // where no one ever used VB will be faster to open. var maxLanguageVersion = Enum.GetValues(typeof(LanguageVersion)).Cast <LanguageVersion>().Max(); var features = _featureDiscovery.SlowDiscoverAll().ToDictionary(f => f, f => (string)null); o.ParseOptions = new VisualBasicParseOptions(maxLanguageVersion).WithFeatures(features); o.MetadataReferences = _referenceCollector.SlowGetMetadataReferencesRecursive( typeof(StandardModuleAttribute).Assembly, typeof(ValueTuple <>).Assembly, typeof(JitGenericAttribute).Assembly ).ToImmutableList(); }); // ReSharper restore HeapView.DelegateAllocation // ReSharper restore HeapView.ObjectAllocation.Evident }