未验证 提交 0b79b9f6 编写于 作者: A Abhitej John 提交者: GitHub

Merge pull request #24661 from dotnet/merges/dev15.6.x-to-dev15.7.x-20180206-080012

Merge dev15.6.x to dev15.7.x
......@@ -144,7 +144,7 @@
<MicrosoftDiaSymReaderPdb2PdbVersion>1.1.0-beta1-62506-02</MicrosoftDiaSymReaderPdb2PdbVersion>
<RestSharpVersion>105.2.3</RestSharpVersion>
<RoslynBuildUtilVersion>0.9.8-beta</RoslynBuildUtilVersion>
<RoslynDependenciesOptimizationDataVersion>2.6.0-beta1-62205-01</RoslynDependenciesOptimizationDataVersion>
<RoslynDependenciesOptimizationDataVersion>2.7.0-beta3-62526-01-2</RoslynDependenciesOptimizationDataVersion>
<RoslynToolsMicrosoftLocateVSVersion>0.2.4-beta</RoslynToolsMicrosoftLocateVSVersion>
<RoslynToolsMicrosoftSignToolVersion>0.3.7-beta</RoslynToolsMicrosoftSignToolVersion>
<RoslynToolsMicrosoftVSIXExpInstallerVersion>0.4.0-beta</RoslynToolsMicrosoftVSIXExpInstallerVersion>
......
......@@ -441,7 +441,7 @@ internal static IAssemblyName ToAssemblyNameObject(AssemblyName name)
throw new ArgumentException(Scripting.ScriptingResources.InvalidCharactersInAssemblyName, nameof(name));
#elif WORKSPACE_DESKTOP
#elif WORKSPACE_DESKTOP || EDITOR_FEATURES
throw new ArgumentException(Microsoft.CodeAnalysis.WorkspaceDesktopResources.Invalid_characters_in_assembly_name, nameof(name));
......@@ -471,7 +471,7 @@ internal static IAssemblyName ToAssemblyNameObject(AssemblyName name)
throw new ArgumentException(Microsoft.CodeAnalysis.Scripting.ScriptingResources.InvalidCharactersInAssemblyName, nameof(name));
#elif WORKSPACE_DESKTOP
#elif WORKSPACE_DESKTOP || EDITOR_FEATURES
throw new ArgumentException(Microsoft.CodeAnalysis.WorkspaceDesktopResources.Invalid_characters_in_assembly_name, nameof(name));
......
......@@ -9,6 +9,7 @@
<AssemblyName>Microsoft.CodeAnalysis.EditorFeatures</AssemblyName>
<TargetFramework>net46</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefineConstants>$(DefineConstants);EDITOR_FEATURES</DefineConstants>
</PropertyGroup>
<ItemGroup Label="Project References">
<ProjectReference Include="..\..\Compilers\Core\Portable\CodeAnalysis.csproj" />
......@@ -94,6 +95,12 @@
<InternalsVisibleToFSharp Include="FSharp.Editor" />
<InternalsVisibleToMoq Include="DynamicProxyGenAssembly2" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\Compilers\Shared\GlobalAssemblyCacheHelpers\ClrGlobalAssemblyCache.cs" Link="Shared\GlobalAssemblyCacheHelpers\ClrGlobalAssemblyCache.cs" />
<Compile Include="..\..\Compilers\Shared\GlobalAssemblyCacheHelpers\FusionAssemblyIdentity.cs" Link="Shared\GlobalAssemblyCacheHelpers\FusionAssemblyIdentity.cs" />
<Compile Include="..\..\Compilers\Shared\GlobalAssemblyCacheHelpers\GlobalAssemblyCache.cs" Link="Shared\GlobalAssemblyCacheHelpers\GlobalAssemblyCache.cs" />
<Compile Include="..\..\Compilers\Shared\GlobalAssemblyCacheHelpers\MonoGlobalAssemblyCache.cs" Link="Shared\GlobalAssemblyCacheHelpers\MonoGlobalAssemblyCache.cs" />
</ItemGroup>
<ItemGroup>
<Compile Update="EditorFeaturesResources.Designer.cs">
<DependentUpon>EditorFeaturesResources.resx</DependentUpon>
......
......@@ -3,8 +3,10 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
......@@ -117,7 +119,8 @@ public async Task<MetadataAsSourceFile> GetGeneratedFileAsync(Project project, I
var useDecompiler = allowDecompilation;
if (useDecompiler)
{
useDecompiler = !symbol.ContainingAssembly.GetAttributes().Any(attribute => attribute.AttributeClass.Name == nameof(SuppressIldasmAttribute));
useDecompiler = !symbol.ContainingAssembly.GetAttributes().Any(attribute => attribute.AttributeClass.Name == nameof(SuppressIldasmAttribute)
&& attribute.AttributeClass.ToNameDisplayString() == typeof(SuppressIldasmAttribute).FullName);
}
if (useDecompiler)
......@@ -194,10 +197,34 @@ private async Task<Document> DecompileSymbolAsync(Document temporaryDocument, IS
var fullName = GetFullReflectionName(containingOrThis);
var compilation = await temporaryDocument.Project.GetCompilationAsync(cancellationToken).ConfigureAwait(false);
// TODO: retrieve path to actual assembly instead of reference assembly
var reference = compilation.GetMetadataReference(symbol.ContainingAssembly);
string assemblyLocation = null;
var isReferenceAssembly = symbol.ContainingAssembly.GetAttributes().Any(attribute => attribute.AttributeClass.Name == nameof(ReferenceAssemblyAttribute)
&& attribute.AttributeClass.ToNameDisplayString() == typeof(ReferenceAssemblyAttribute).FullName);
if (isReferenceAssembly)
{
try
{
var fullAssemblyName = symbol.ContainingAssembly.Identity.GetDisplayName();
GlobalAssemblyCache.Instance.ResolvePartialName(fullAssemblyName, out assemblyLocation, preferredCulture: CultureInfo.CurrentCulture);
}
catch (Exception e) when (FatalError.ReportWithoutCrash(e))
{
}
}
if (assemblyLocation == null)
{
var reference = compilation.GetMetadataReference(symbol.ContainingAssembly);
assemblyLocation = (reference as PortableExecutableReference)?.FilePath;
if (assemblyLocation == null)
{
throw new NotSupportedException(EditorFeaturesResources.Cannot_navigate_to_the_symbol_under_the_caret);
}
}
// Load the assembly.
var ad = AssemblyDefinition.ReadAssembly(reference.Display, new ReaderParameters() { AssemblyResolver = new RoslynAssemblyResolver(compilation) });
var ad = AssemblyDefinition.ReadAssembly(assemblyLocation, new ReaderParameters() { AssemblyResolver = new RoslynAssemblyResolver(compilation) });
// Initialize a decompiler with default settings.
var decompiler = new CSharpDecompiler(ad.MainModule, new DecompilerSettings());
......
......@@ -32,7 +32,7 @@ internal static ForegroundThreadData CreateDefault(ForegroundThreadDataKind defa
{
var kind = ForegroundThreadDataInfo.CreateDefault(defaultKind);
return new ForegroundThreadData(Thread.CurrentThread, new SynchronizationContextTaskScheduler(SynchronizationContext.Current), kind);
return new ForegroundThreadData(Thread.CurrentThread, SynchronizationContext.Current == null ? TaskScheduler.Default : new SynchronizationContextTaskScheduler(SynchronizationContext.Current), kind);
}
}
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
extern alias Scripting;
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
......@@ -9,7 +10,6 @@
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Completion;
using Microsoft.CodeAnalysis.PooledObjects;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.CodeAnalysis.Shared.Utilities;
using Roslyn.Utilities;
......@@ -18,7 +18,7 @@ namespace Microsoft.CodeAnalysis.Editor.Completion.FileSystem
internal sealed class GlobalAssemblyCacheCompletionHelper
{
private static readonly Lazy<List<string>> s_lazyAssemblySimpleNames =
new Lazy<List<string>>(() => GlobalAssemblyCache.Instance.GetAssemblySimpleNames().ToList());
new Lazy<List<string>>(() => Scripting::Microsoft.CodeAnalysis.GlobalAssemblyCache.Instance.GetAssemblySimpleNames().ToList());
private readonly CompletionItemRules _itemRules;
......@@ -61,7 +61,7 @@ internal ImmutableArray<CompletionItem> GetItems(string directoryPath, Cancellat
private IEnumerable<AssemblyIdentity> GetAssemblyIdentities(string partialName)
{
return IOUtilities.PerformIO(() => GlobalAssemblyCache.Instance.GetAssemblyIdentities(partialName),
return IOUtilities.PerformIO(() => Scripting::Microsoft.CodeAnalysis.GlobalAssemblyCache.Instance.GetAssemblyIdentities(partialName),
SpecializedCollections.EmptyEnumerable<AssemblyIdentity>());
}
}
......
......@@ -38,7 +38,7 @@ static void Main(string[] args)
// TODO: Validate build works as expected
}
[Fact(Skip = "https://github.com/dotnet/roslyn/issues/18299"), Trait(Traits.Feature, Traits.Features.Build)]
[Fact, Trait(Traits.Feature, Traits.Features.Build)]
public void BuildWithCommandLine()
{
VisualStudio.SolutionExplorer.SaveAll();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册