Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
a9332299
R
roslyn
项目概览
lwm1986
/
roslyn
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roslyn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a9332299
编写于
6月 12, 2015
作者:
A
Andy Gocke
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3405 from agocke/CompilationAssemblyIdentity
Fix bad errors in the error list -- bug 1166689
上级
33c4a054
f6c744a3
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
123 addition
and
2 deletion
+123
-2
src/Compilers/CSharp/Portable/Symbols/ReferenceManager.cs
src/Compilers/CSharp/Portable/Symbols/ReferenceManager.cs
+4
-0
src/Compilers/CSharp/Test/Symbol/Compilation/ReferenceManagerTests.cs
...s/CSharp/Test/Symbol/Compilation/ReferenceManagerTests.cs
+28
-0
src/Compilers/Core/Portable/MetadataReference/AssemblyIdentityComparer.cs
...re/Portable/MetadataReference/AssemblyIdentityComparer.cs
+1
-0
src/Compilers/Core/Portable/ReferenceManager/AssemblyData.cs
src/Compilers/Core/Portable/ReferenceManager/AssemblyData.cs
+6
-0
src/Compilers/Core/Portable/ReferenceManager/AssemblyDataForAssemblyBeingBuilt.cs
...ble/ReferenceManager/AssemblyDataForAssemblyBeingBuilt.cs
+2
-0
src/Compilers/Core/Portable/ReferenceManager/CommonReferenceManager.Resolution.cs
...ble/ReferenceManager/CommonReferenceManager.Resolution.cs
+27
-0
src/Compilers/Test/Resources/Core/CompilerTestResources.vbproj
...ompilers/Test/Resources/Core/CompilerTestResources.vbproj
+2
-0
src/Compilers/Test/Resources/Core/WinRt/MakeWinMds.cmd
src/Compilers/Test/Resources/Core/WinRt/MakeWinMds.cmd
+1
-0
src/Compilers/Test/Resources/Core/WinRt/WImpl.il
src/Compilers/Test/Resources/Core/WinRt/WImpl.il
+24
-0
src/Compilers/Test/Resources/Core/WinRt/WImpl.winmd
src/Compilers/Test/Resources/Core/WinRt/WImpl.winmd
+0
-0
src/Compilers/Test/Resources/Core/WinRt/WinRt.Designer.vb
src/Compilers/Test/Resources/Core/WinRt/WinRt.Designer.vb
+11
-1
src/Compilers/Test/Resources/Core/WinRt/WinRt.resx
src/Compilers/Test/Resources/Core/WinRt/WinRt.resx
+3
-0
src/Compilers/VisualBasic/Portable/Symbols/ReferenceManager.vb
...ompilers/VisualBasic/Portable/Symbols/ReferenceManager.vb
+12
-0
src/VisualStudio/Core/Def/Implementation/ProjectSystem/AbstractProject.cs
.../Core/Def/Implementation/ProjectSystem/AbstractProject.cs
+2
-1
未找到文件。
src/Compilers/CSharp/Portable/Symbols/ReferenceManager.cs
浏览文件 @
a9332299
...
...
@@ -1027,6 +1027,8 @@ public override bool DeclaresTheObjectClass
return
_assembly
.
DeclaresTheObjectClass
;
}
}
public
override
Compilation
SourceCompilation
=>
null
;
}
private
sealed
class
AssemblyDataForCompilation
:
AssemblyDataForMetadataOrCompilation
...
...
@@ -1130,6 +1132,8 @@ public override bool DeclaresTheObjectClass
return
_compilation
.
DeclaresTheObjectClass
;
}
}
public
override
Compilation
SourceCompilation
=>
_compilation
;
}
/// <summary>
...
...
src/Compilers/CSharp/Test/Symbol/Compilation/ReferenceManagerTests.cs
浏览文件 @
a9332299
...
...
@@ -23,6 +23,34 @@ public class ReferenceManagerTests : CSharpTestBase
WithCryptoKeyFile
(
SigningTestHelpers
.
KeyPairFile
).
WithStrongNameProvider
(
new
SigningTestHelpers
.
VirtualizedStrongNameProvider
(
ImmutableArray
.
Create
<
string
>()));
[
ClrOnlyFact
(
ClrOnlyReason
.
Signing
)]
public
void
WinRtCompilationReferences
()
{
var
ifaceDef
=
CreateCompilationWithMscorlib
(
@"
public interface ITest
{
}"
,
options
:
TestOptions
.
DebugWinMD
,
assemblyName
:
"ITest"
);
ifaceDef
.
VerifyDiagnostics
();
var
ifaceImageRef
=
ifaceDef
.
EmitToImageReference
();
var
wimpl
=
AssemblyMetadata
.
CreateFromImage
(
TestResources
.
WinRt
.
WImpl
).
GetReference
(
display
:
"WImpl"
);
var
implDef2
=
CreateCompilationWithMscorlib
(
@"
public class C
{
public static void Main()
{
ITest test = new WImpl();
}
}"
,
references
:
new
MetadataReference
[]
{
ifaceDef
.
ToMetadataReference
(),
wimpl
},
options
:
TestOptions
.
DebugExe
);
implDef2
.
VerifyDiagnostics
();
}
[
ClrOnlyFact
(
ClrOnlyReason
.
Signing
)]
public
void
VersionUnification_SymbolUsed
()
{
...
...
src/Compilers/Core/Portable/MetadataReference/AssemblyIdentityComparer.cs
浏览文件 @
a9332299
...
...
@@ -218,3 +218,4 @@ internal virtual bool ApplyUnificationPolicies(ref AssemblyIdentity reference, r
}
}
}
src/Compilers/Core/Portable/ReferenceManager/AssemblyData.cs
浏览文件 @
a9332299
...
...
@@ -57,6 +57,12 @@ internal abstract class AssemblyData
public
abstract
bool
IsLinked
{
get
;
}
public
abstract
bool
DeclaresTheObjectClass
{
get
;
}
/// <summary>
/// Get the source compilation backing this assembly, if one exists.
/// Returns null otherwise.
/// </summary>
public
abstract
Compilation
SourceCompilation
{
get
;
}
}
}
}
src/Compilers/Core/Portable/ReferenceManager/AssemblyDataForAssemblyBeingBuilt.cs
浏览文件 @
a9332299
...
...
@@ -144,6 +144,8 @@ public override bool DeclaresTheObjectClass
return
false
;
}
}
public
override
Compilation
SourceCompilation
=>
null
;
}
}
}
src/Compilers/Core/Portable/ReferenceManager/CommonReferenceManager.Resolution.cs
浏览文件 @
a9332299
...
...
@@ -10,6 +10,7 @@
namespace
Microsoft.CodeAnalysis
{
using
System.Reflection
;
using
MetadataOrDiagnostic
=
System
.
Object
;
/// <summary>
...
...
@@ -850,6 +851,32 @@ private static PortableExecutableReference ResolveReferenceDirective(string refe
}
}
// In the IDE it is possible the reference we're looking for is a
// compilation reference to a source assembly. However, if the reference
// is of ContentType WindowsRuntime then the compilation will never
// match since all C#/VB WindowsRuntime compilations output .winmdobjs,
// not .winmds, and the ContentType of a .winmdobj is Default.
// If this is the case, we want to ignore the ContentType mismatch and
// allow the compilation to match the reference.
if
(
reference
.
ContentType
==
AssemblyContentType
.
WindowsRuntime
)
{
for
(
int
i
=
definitionOffset
;
i
<
definitions
.
Length
;
i
++)
{
var
definition
=
definitions
[
i
].
Identity
;
var
sourceCompilation
=
definitions
[
i
].
SourceCompilation
;
if
(
definition
.
ContentType
==
AssemblyContentType
.
Default
&&
sourceCompilation
?.
Options
.
OutputKind
==
OutputKind
.
WindowsRuntimeMetadata
&&
AssemblyIdentityComparer
.
SimpleNameComparer
.
Equals
(
reference
.
Name
,
definition
.
Name
)
&&
reference
.
Version
.
Equals
(
definition
.
Version
)
&&
reference
.
IsRetargetable
==
definition
.
IsRetargetable
&&
AssemblyIdentityComparer
.
CultureComparer
.
Equals
(
reference
.
CultureName
,
definition
.
CultureName
)
&&
AssemblyIdentity
.
KeysEqual
(
reference
,
definition
))
{
return
new
AssemblyReferenceBinding
(
reference
,
i
);
}
}
}
// As in the native compiler (see IMPORTER::MapAssemblyRefToAid), we compare against the
// compilation (i.e. source) assembly as a last resort. We follow the native approach of
// skipping the public key comparison since we have yet to compute it.
...
...
src/Compilers/Test/Resources/Core/CompilerTestResources.vbproj
浏览文件 @
a9332299
...
...
@@ -406,6 +406,8 @@
<None
Include=
"packages.config"
/>
<None
Include=
"SymbolsTests\netModule\hash_module.cs"
/>
<None
Include=
"SymbolsTests\NoPia\MissingPIAAttributes.dll"
/>
<None
Include=
"WinRt\WImpl.il"
/>
<None
Include=
"WinRt\WImpl.winmd"
/>
</ItemGroup>
<ItemGroup>
<EmbeddedResource
Include=
"Analyzers\AnalyzerTests.resx"
>
...
...
src/Compilers/Test/Resources/Core/WinRt/MakeWinMds.cmd
浏览文件 @
a9332299
...
...
@@ -5,3 +5,4 @@ ilasm W1.il /mdv="WindowsRuntime 1.2" /msv:1.1 /dll /out=W1.winmd
ilasm
W2
.il
/mdv
=
"WindowsRuntime 1.2"
/msv
:1.1
/dll /out
=
W2
.winmd
ilasm
WB
.il
/mdv
=
"WindowsRuntime 1.2"
/msv
:1.1
/dll /out
=
WB
.winmd
ilasm
WB_Version1
.il
/mdv
=
"WindowsRuntime 1.2"
/msv
:1.1
/dll /out
=
WB_Version1
.winmd
ilasm
WImpl
.il
/mdv
=
"WindowsRuntime 1.3"
/msv
:1.1
/dll /out
=
WImpl
.winmd
src/Compilers/Test/Resources/Core/WinRt/WImpl.il
0 → 100644
浏览文件 @
a9332299
.assembly extern windowsruntime ITest {}
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 )
.ver 255:255:255:255
}
.assembly windowsruntime WImpl
{
.hash algorithm 0x00008004
.ver 255:255:255:255
}
.module WImpl.winmd
.class public auto ansi windowsruntime sealed WImpl
extends System.Object
implements [ITest]ITest
{
.method public hidebysig specialname rtspecialname
instance void .ctor() runtime managed
{
}
}
\ No newline at end of file
src/Compilers/Test/Resources/Core/WinRt/WImpl.winmd
0 → 100644
浏览文件 @
a9332299
文件已添加
src/Compilers/Test/Resources/Core/WinRt/WinRt.Designer.vb
浏览文件 @
a9332299
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.
18326
' Runtime Version:4.0.30319.
42000
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
...
...
@@ -104,6 +104,16 @@ Namespace TestResources
End
Get
End
Property
'''<summary>
''' Looks up a localized resource of type System.Byte[].
'''</summary>
Public
Shared
ReadOnly
Property
WImpl
()
As
Byte
()
Get
Dim
obj
As
Object
=
ResourceManager
.
GetObject
(
"WImpl"
,
resourceCulture
)
Return
CType
(
obj
,
Byte
())
End
Get
End
Property
'''<summary>
''' Looks up a localized resource of type System.Byte[].
'''</summary>
...
...
src/Compilers/Test/Resources/Core/WinRt/WinRt.resx
浏览文件 @
a9332299
...
...
@@ -147,4 +147,7 @@
<data
name=
"WinMDPrefixing_dump"
type=
"System.Resources.ResXFileRef, System.Windows.Forms"
>
<value>
WinMDPrefixing.ildump;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
</value>
</data>
<data
name=
"WImpl"
type=
"System.Resources.ResXFileRef, System.Windows.Forms"
>
<value>
WImpl.winmd;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
</value>
</data>
</root>
src/Compilers/VisualBasic/Portable/Symbols/ReferenceManager.vb
浏览文件 @
a9332299
...
...
@@ -869,6 +869,12 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Return
_assembly
.
DeclaresTheObjectClass
End
Get
End
Property
Public
Overrides
ReadOnly
Property
SourceCompilation
As
Compilation
Get
Return
Nothing
End
Get
End
Property
End
Class
Private
NotInheritable
Class
AssemblyDataForCompilation
...
...
@@ -955,6 +961,12 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Return
_compilation
.
DeclaresTheObjectClass
End
Get
End
Property
Public
Overrides
ReadOnly
Property
SourceCompilation
As
Compilation
Get
Return
_compilation
End
Get
End
Property
End
Class
''' <summary>
...
...
src/VisualStudio/Core/Def/Implementation/ProjectSystem/AbstractProject.cs
浏览文件 @
a9332299
...
...
@@ -413,7 +413,8 @@ private static string GetAssemblyName(string outputPath)
// dev11 sometimes gives us output path w/o extension, so removing extension becomes problematic
if
(
outputPath
.
EndsWith
(
".exe"
,
StringComparison
.
OrdinalIgnoreCase
)
||
outputPath
.
EndsWith
(
".dll"
,
StringComparison
.
OrdinalIgnoreCase
)
||
outputPath
.
EndsWith
(
".netmodule"
,
StringComparison
.
OrdinalIgnoreCase
))
outputPath
.
EndsWith
(
".netmodule"
,
StringComparison
.
OrdinalIgnoreCase
)
||
outputPath
.
EndsWith
(
".winmdobj"
,
StringComparison
.
OrdinalIgnoreCase
))
{
return
Path
.
GetFileNameWithoutExtension
(
outputPath
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录