Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
8ae9f841
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,发现更多精彩内容 >>
未验证
提交
8ae9f841
编写于
8月 30, 2019
作者:
A
AlekseyTs
提交者:
GitHub
8月 30, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Properly detect whether an explicit event implementation in an interface is a WinRT event. (#38394)
Fixes #36532. Closes #34658.
上级
fee6ab20
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
396 addition
and
14 deletion
+396
-14
eng/Versions.props
eng/Versions.props
+1
-1
src/Compilers/CSharp/Portable/Symbols/Source/SourceEventSymbol.cs
...ilers/CSharp/Portable/Symbols/Source/SourceEventSymbol.cs
+7
-7
src/Compilers/CSharp/Test/Symbol/Symbols/DefaultInterfaceImplementationTests.cs
...est/Symbol/Symbols/DefaultInterfaceImplementationTests.cs
+286
-3
src/Compilers/VisualBasic/Test/Symbol/SymbolsTests/DefaultInterfaceImplementationTests.vb
...ymbol/SymbolsTests/DefaultInterfaceImplementationTests.vb
+94
-2
src/Test/Utilities/Portable/Mocks/TestReferences.cs
src/Test/Utilities/Portable/Mocks/TestReferences.cs
+5
-0
src/Test/Utilities/Portable/TargetFrameworkUtil.cs
src/Test/Utilities/Portable/TargetFrameworkUtil.cs
+3
-1
未找到文件。
eng/Versions.props
浏览文件 @
8ae9f841
...
...
@@ -58,7 +58,7 @@
<MicrosoftCodeAnalysisCSharpCodeFixTestingXUnitVersion>
$(MicrosoftCodeAnalysisTestingVersion)
</MicrosoftCodeAnalysisCSharpCodeFixTestingXUnitVersion>
<MicrosoftCodeAnalysisCSharpCodeStyleVersion>
$(CodeStyleAnalyzerVersion)
</MicrosoftCodeAnalysisCSharpCodeStyleVersion>
<MicrosoftCodeAnalysisElfieVersion>
0.10.6
</MicrosoftCodeAnalysisElfieVersion>
<MicrosoftCodeAnalysisTestResourcesProprietaryVersion>
2.0.1
8
</MicrosoftCodeAnalysisTestResourcesProprietaryVersion>
<MicrosoftCodeAnalysisTestResourcesProprietaryVersion>
2.0.1
9
</MicrosoftCodeAnalysisTestResourcesProprietaryVersion>
<MicrosoftCodeAnalysisVisualBasicCodeFixTestingXUnitVersion>
$(MicrosoftCodeAnalysisTestingVersion)
</MicrosoftCodeAnalysisVisualBasicCodeFixTestingXUnitVersion>
<MicrosoftCodeAnalysisVisualBasicCodeStyleVersion>
$(CodeStyleAnalyzerVersion)
</MicrosoftCodeAnalysisVisualBasicCodeStyleVersion>
<MicrosoftCodeAnalysisFlowAnalysisUtilitiesVersion>
2.9.4
</MicrosoftCodeAnalysisFlowAnalysisUtilitiesVersion>
...
...
src/Compilers/CSharp/Portable/Symbols/Source/SourceEventSymbol.cs
浏览文件 @
8ae9f841
...
...
@@ -636,13 +636,6 @@ public sealed override bool IsWindowsRuntimeEvent
private
bool
ComputeIsWindowsRuntimeEvent
()
{
// Interface events don't override or implement other events, so they only
// depend the output kind.
if
(
this
.
containingType
.
IsInterfaceType
())
{
return
this
.
IsCompilationOutputWinMdObj
();
}
// If you explicitly implement an event, then you're a WinRT event if and only if it's a WinRT event.
ImmutableArray
<
EventSymbol
>
explicitInterfaceImplementations
=
this
.
ExplicitInterfaceImplementations
;
if
(!
explicitInterfaceImplementations
.
IsEmpty
)
...
...
@@ -655,6 +648,13 @@ private bool ComputeIsWindowsRuntimeEvent()
return
explicitInterfaceImplementations
[
0
].
IsWindowsRuntimeEvent
;
}
// Interface events don't override or implicitly implement other events, so they only
// depend on the output kind at this point.
if
(
this
.
containingType
.
IsInterfaceType
())
{
return
this
.
IsCompilationOutputWinMdObj
();
}
// If you override an event, then you're a WinRT event if and only if it's a WinRT event.
EventSymbol
overriddenEvent
=
this
.
OverriddenEvent
;
if
((
object
)
overriddenEvent
!=
null
)
...
...
src/Compilers/CSharp/Test/Symbol/Symbols/DefaultInterfaceImplementationTests.cs
浏览文件 @
8ae9f841
...
...
@@ -8700,7 +8700,7 @@ class Test2 : I1
Assert.Null(test2.FindImplementationForInterfaceMember(m5));
}
[Fact
(Skip = "https://github.com/dotnet/roslyn/issues/34658")
]
[Fact]
[WorkItem(34658, "https://github.com/dotnet/roslyn/issues/34658")]
public void MethodModifiers_18()
{
...
...
@@ -29715,8 +29715,7 @@ static void Main()
var compilation1 = CreateCompilation(source1, options: TestOptions.DebugExe,
parseOptions: TestOptions.Regular,
targetFramework: TargetFramework.NetStandardLatest,
references: new[] { TestReferences.NetCoreApp30.SystemThreadingTasksRef });
targetFramework: TargetFramework.NetStandardLatest);
Assert.True(compilation1.Assembly.RuntimeSupportsDefaultInterfaceImplementation);
compilation1.VerifyDiagnostics();
...
...
@@ -54401,5 +54400,289 @@ static void Main()
);
}
[Fact]
[WorkItem(36532, "https://github.com/dotnet/roslyn/issues/36532")]
public void WindowsRuntimeEvent_01()
{
AssemblyIdentity systemRuntimeIdentity = ((AssemblyMetadata)TestReferences.NetCoreApp30.SystemRuntimeRef.GetMetadata()).GetAssembly().Identity;
AssemblyIdentity systemRuntimeInteropServicesWindowsRuntimeIdentity = ((AssemblyMetadata)TestReferences.NetCoreApp30.SystemRuntimeInteropServicesWindowsRuntimeRef.GetMetadata()).GetAssembly().Identity;
Version systemRuntimeVersion = systemRuntimeIdentity.Version;
Version systemRuntimeInteropServicesWindowsRuntimeVersion = systemRuntimeInteropServicesWindowsRuntimeIdentity.Version;
var systemRuntimePublicKeyToken = systemRuntimeIdentity.PublicKeyToken;
var systemRuntimeInteropServicesWindowsRuntimePublicKeyToken = systemRuntimeInteropServicesWindowsRuntimeIdentity.PublicKeyToken;
var ilSource = @"
.assembly extern System.Runtime
{
.publickeytoken = (" +
systemRuntimePublicKeyToken[0].ToString("X2") +
systemRuntimePublicKeyToken[1].ToString("X2") +
systemRuntimePublicKeyToken[2].ToString("X2") +
systemRuntimePublicKeyToken[3].ToString("X2") +
systemRuntimePublicKeyToken[4].ToString("X2") +
systemRuntimePublicKeyToken[5].ToString("X2") +
systemRuntimePublicKeyToken[6].ToString("X2") +
systemRuntimePublicKeyToken[7].ToString("X2") +
@" )
.ver " + $"{systemRuntimeVersion.Major}:{systemRuntimeVersion.Minor}:{systemRuntimeVersion.Build}:{systemRuntimeVersion.Revision}" + @"
}
.assembly extern System.Runtime.InteropServices.WindowsRuntime
{
.publickeytoken = (" +
systemRuntimeInteropServicesWindowsRuntimePublicKeyToken[0].ToString("X2") +
systemRuntimeInteropServicesWindowsRuntimePublicKeyToken[1].ToString("X2") +
systemRuntimeInteropServicesWindowsRuntimePublicKeyToken[2].ToString("X2") +
systemRuntimeInteropServicesWindowsRuntimePublicKeyToken[3].ToString("X2") +
systemRuntimeInteropServicesWindowsRuntimePublicKeyToken[4].ToString("X2") +
systemRuntimeInteropServicesWindowsRuntimePublicKeyToken[5].ToString("X2") +
systemRuntimeInteropServicesWindowsRuntimePublicKeyToken[6].ToString("X2") +
systemRuntimeInteropServicesWindowsRuntimePublicKeyToken[7].ToString("X2") +
@" )
.ver " + $"{systemRuntimeInteropServicesWindowsRuntimeVersion.Major}:{systemRuntimeInteropServicesWindowsRuntimeVersion.Minor}:{systemRuntimeInteropServicesWindowsRuntimeVersion.Build}:{systemRuntimeInteropServicesWindowsRuntimeVersion.Revision}" + @"
}
.class public auto ansi sealed Event
extends [System.Runtime]System.MulticastDelegate
{
.method private hidebysig specialname rtspecialname
instance void .ctor(object 'object',
native int 'method') runtime managed
{
}
.method public hidebysig newslot specialname virtual
instance void Invoke() runtime managed
{
}
} // end of class Event
.class interface public abstract auto ansi Interface`1<T>
{
.method public hidebysig newslot specialname abstract virtual
instance void add_Normal(class Event 'value') cil managed
{
}
.method public hidebysig newslot specialname abstract virtual
instance void remove_Normal(class Event 'value') cil managed
{
}
.method public hidebysig newslot specialname abstract virtual
instance valuetype [System.Runtime.InteropServices.WindowsRuntime]System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken
add_WinRT([in] class Event 'value') cil managed
{
}
.method public hidebysig newslot specialname abstract virtual
instance void remove_WinRT([in] valuetype [System.Runtime.InteropServices.WindowsRuntime]System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken 'value') cil managed
{
}
.event Event Normal
{
.addon instance void Interface`1::add_Normal(class Event)
.removeon instance void Interface`1::remove_Normal(class Event)
} // end of event I`1::Normal
.event Event WinRT
{
.addon instance valuetype [System.Runtime.InteropServices.WindowsRuntime]System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken Interface`1::add_WinRT(class Event)
.removeon instance void Interface`1::remove_WinRT(valuetype [System.Runtime.InteropServices.WindowsRuntime]System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken)
}
} // end of class Interface
";
var source = @"
interface I1 : Interface<int>
{
event Event Interface<int>.Normal
{
add { throw null; }
remove { throw null; }
}
event Event Interface<int>.WinRT
{
add
{
return new System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken();
}
remove
{
System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken x = value;
x.ToString();
}
}
}
class C1 : I1, Interface<int>
{}
";
foreach (var options in new[] { TestOptions.DebugDll, TestOptions.DebugWinMD })
{
var comp = CreateCompilationWithIL(source, ilSource, options: options, targetFramework: TargetFramework.NetStandardLatest);
void Validate(ModuleSymbol m)
{
var i1 = m.GlobalNamespace.GetTypeMember("I1");
var c1 = m.GlobalNamespace.GetTypeMember("C1");
var baseInterface = i1.Interfaces().Single();
Assert.True(baseInterface.IsInterface);
Assert.True(i1.IsInterface);
var i1Normal = i1.GetMember<EventSymbol>("Interface<System.Int32>.Normal");
var i1WinRT = i1.GetMember<EventSymbol>("Interface<System.Int32>.WinRT");
var baseInterfaceNormal = baseInterface.GetMember<EventSymbol>("Normal");
var baseInterfaceWinRT = baseInterface.GetMember<EventSymbol>("WinRT");
Assert.False(baseInterfaceNormal.IsWindowsRuntimeEvent);
Assert.False(i1Normal.IsWindowsRuntimeEvent);
Assert.True(baseInterfaceWinRT.IsWindowsRuntimeEvent);
Assert.True(i1WinRT.IsWindowsRuntimeEvent);
Assert.Same(i1Normal, i1.FindImplementationForInterfaceMember(baseInterfaceNormal));
Assert.Same(i1Normal.AddMethod, i1.FindImplementationForInterfaceMember(baseInterfaceNormal.AddMethod));
Assert.Same(i1Normal.RemoveMethod, i1.FindImplementationForInterfaceMember(baseInterfaceNormal.RemoveMethod));
Assert.Same(i1WinRT, i1.FindImplementationForInterfaceMember(baseInterfaceWinRT));
Assert.Same(i1WinRT.AddMethod, i1.FindImplementationForInterfaceMember(baseInterfaceWinRT.AddMethod));
Assert.Same(i1WinRT.RemoveMethod, i1.FindImplementationForInterfaceMember(baseInterfaceWinRT.RemoveMethod));
Assert.Same(i1Normal, c1.FindImplementationForInterfaceMember(baseInterfaceNormal));
Assert.Same(i1Normal.AddMethod, c1.FindImplementationForInterfaceMember(baseInterfaceNormal.AddMethod));
Assert.Same(i1Normal.RemoveMethod, c1.FindImplementationForInterfaceMember(baseInterfaceNormal.RemoveMethod));
Assert.Same(i1WinRT, c1.FindImplementationForInterfaceMember(baseInterfaceWinRT));
Assert.Same(i1WinRT.AddMethod, c1.FindImplementationForInterfaceMember(baseInterfaceWinRT.AddMethod));
Assert.Same(i1WinRT.RemoveMethod, c1.FindImplementationForInterfaceMember(baseInterfaceWinRT.RemoveMethod));
Assert.Equal("void I1.Interface<System.Int32>.Normal.add", i1Normal.AddMethod.ToTestDisplayString());
Assert.Equal("void I1.Interface<System.Int32>.Normal.remove", i1Normal.RemoveMethod.ToTestDisplayString());
Assert.Equal("System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken I1.Interface<System.Int32>.WinRT.add", i1WinRT.AddMethod.ToTestDisplayString());
Assert.Equal("void I1.Interface<System.Int32>.WinRT.remove", i1WinRT.RemoveMethod.ToTestDisplayString());
}
Validate(comp.SourceModule);
CompileAndVerify(comp, verify: VerifyOnMonoOrCoreClr, symbolValidator: Validate);
}
}
[Fact]
[WorkItem(36532, "https://github.com/dotnet/roslyn/issues/36532")]
public void WindowsRuntimeEvent_02()
{
var source = @"
interface I1
{
event System.Action WinRT
{
add
{
return new System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken();
}
remove
{
System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken x = value;
x.ToString();
}
}
}
class C1 : I1
{
}
";
var comp = CreateCompilation(source, options: TestOptions.DebugWinMD, targetFramework: TargetFramework.NetStandardLatest);
void Validate(ModuleSymbol m)
{
var i1 = m.GlobalNamespace.GetTypeMember("I1");
var c1 = m.GlobalNamespace.GetTypeMember("C1");
var i1WinRT = i1.GetMember<EventSymbol>("WinRT");
Assert.True(i1WinRT.IsWindowsRuntimeEvent);
Assert.Same(i1WinRT, c1.FindImplementationForInterfaceMember(i1WinRT));
Assert.Same(i1WinRT.AddMethod, c1.FindImplementationForInterfaceMember(i1WinRT.AddMethod));
Assert.Same(i1WinRT.RemoveMethod, c1.FindImplementationForInterfaceMember(i1WinRT.RemoveMethod));
Assert.Equal("System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken I1.WinRT.add", i1WinRT.AddMethod.ToTestDisplayString());
Assert.Equal("void I1.WinRT.remove", i1WinRT.RemoveMethod.ToTestDisplayString());
}
Validate(comp.SourceModule);
CompileAndVerify(comp, verify: VerifyOnMonoOrCoreClr, symbolValidator: Validate);
}
[Fact]
[WorkItem(36532, "https://github.com/dotnet/roslyn/issues/36532")]
public void WindowsRuntimeEvent_03()
{
var source = @"
interface Interface
{
event System.Action WinRT;
}
interface I1 : Interface
{
event System.Action Interface.WinRT
{
add
{
return new System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken();
}
remove
{
System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken x = value;
x.ToString();
}
}
}
class C1 : I1, Interface
{}
";
var comp = CreateCompilation(source, options: TestOptions.DebugWinMD, targetFramework: TargetFramework.NetStandardLatest);
void Validate(ModuleSymbol m)
{
var i1 = m.GlobalNamespace.GetTypeMember("I1");
var c1 = m.GlobalNamespace.GetTypeMember("C1");
var baseInterface = i1.Interfaces().Single();
Assert.True(baseInterface.IsInterface);
Assert.True(i1.IsInterface);
var i1WinRT = i1.GetMember<EventSymbol>("Interface.WinRT");
var baseInterfaceWinRT = baseInterface.GetMember<EventSymbol>("WinRT");
Assert.True(baseInterfaceWinRT.IsWindowsRuntimeEvent);
Assert.True(i1WinRT.IsWindowsRuntimeEvent);
Assert.Same(i1WinRT, i1.FindImplementationForInterfaceMember(baseInterfaceWinRT));
Assert.Same(i1WinRT.AddMethod, i1.FindImplementationForInterfaceMember(baseInterfaceWinRT.AddMethod));
Assert.Same(i1WinRT.RemoveMethod, i1.FindImplementationForInterfaceMember(baseInterfaceWinRT.RemoveMethod));
Assert.Same(i1WinRT, c1.FindImplementationForInterfaceMember(baseInterfaceWinRT));
Assert.Same(i1WinRT.AddMethod, c1.FindImplementationForInterfaceMember(baseInterfaceWinRT.AddMethod));
Assert.Same(i1WinRT.RemoveMethod, c1.FindImplementationForInterfaceMember(baseInterfaceWinRT.RemoveMethod));
Assert.Equal("System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken I1.Interface.WinRT.add", i1WinRT.AddMethod.ToTestDisplayString());
Assert.Equal("void I1.Interface.WinRT.remove", i1WinRT.RemoveMethod.ToTestDisplayString());
}
Validate(comp.SourceModule);
CompileAndVerify(comp, verify: VerifyOnMonoOrCoreClr, symbolValidator: Validate);
}
}
}
src/Compilers/VisualBasic/Test/Symbol/SymbolsTests/DefaultInterfaceImplementationTests.vb
浏览文件 @
8ae9f841
...
...
@@ -16,10 +16,16 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests
Public
Class
DefaultInterfaceImplementationTests
Inherits
BasicTestBase
Private
Function
GetCSharpCompilation
(
csSource
As
String
,
Optional
additionalReferences
As
MetadataReference
()
=
Nothing
,
Optional
targetFramework
As
TargetFramework
=
TargetFramework
.
NetStandardLatest
)
As
CSharp
.
CSharpCompilation
Private
Function
GetCSharpCompilation
(
csSource
As
String
,
Optional
additionalReferences
As
MetadataReference
()
=
Nothing
,
Optional
targetFramework
As
TargetFramework
=
TargetFramework
.
NetStandardLatest
,
Optional
compilationOptions
As
CSharp
.
CSharpCompilationOptions
=
Nothing
)
As
CSharp
.
CSharpCompilation
Return
CreateCSharpCompilation
(
csSource
,
parseOptions
:
=
CSharp
.
CSharpParseOptions
.
Default
.
WithLanguageVersion
(
CSharp
.
LanguageVersion
.
CSharp8
),
referencedAssemblies
:
=
TargetFrameworkUtil
.
GetReferences
(
targetFramework
,
additionalReferences
))
referencedAssemblies
:
=
TargetFrameworkUtil
.
GetReferences
(
targetFramework
,
additionalReferences
),
compilationOptions
:
=
compilationOptions
)
End
Function
Private
Shared
ReadOnly
Property
VerifyOnMonoOrCoreClr
As
Verification
...
...
@@ -11287,6 +11293,92 @@ BC30452: Operator '-' is not defined for types 'C1' and 'I1'.
</
expected
>
)
End
Sub
<
Fact
>
<
WorkItem
(
36532
,
"https://github.com/dotnet/roslyn/issues/36532"
)
>
Public
Sub
WindowsRuntimeEvent_01
()
Dim
csSource
=
"
public interface I1
{
event System.Action WinRT
{
add { throw null; }
remove { throw null; }
}
}
public interface I2 : I1
{
event System.Action I1.WinRT
{
add { throw null; }
remove { throw null; }
}
}
"
Dim
csCompilation
=
GetCSharpCompilation
(
csSource
,
compilationOptions
:
=
New
CSharp
.
CSharpCompilationOptions
(
OutputKind
.
WindowsRuntimeMetadata
)).
EmitToImageReference
()
Dim
source1
=
<
compilation
>
<
file
name
=
"c.vb"
><
!
[
CDATA
[
Public
Class
C1
Implements
I1
Custom
Event
E1
As
System
.
Action
Implements
I1
.
WinRT
AddHandler
(
value
As
System
.
Action
)
Return
new
System
.
Runtime
.
InteropServices
.
WindowsRuntime
.
EventRegistrationToken
()
End
AddHandler
RemoveHandler
(
value
As
System
.
Runtime
.
InteropServices
.
WindowsRuntime
.
EventRegistrationToken
)
End
RemoveHandler
RaiseEvent
()
End
RaiseEvent
End
Event
End
Class
Public
Class
C2
Implements
I2
Custom
Event
E2
As
System
.
Action
Implements
I1
.
WinRT
AddHandler
(
value
As
System
.
Action
)
Return
new
System
.
Runtime
.
InteropServices
.
WindowsRuntime
.
EventRegistrationToken
()
End
AddHandler
RemoveHandler
(
value
As
System
.
Runtime
.
InteropServices
.
WindowsRuntime
.
EventRegistrationToken
)
End
RemoveHandler
RaiseEvent
()
End
RaiseEvent
End
Event
End
Class
]]
></
file
>
</
compilation
>
Dim
comp1
=
CreateCompilation
(
source1
,
options
:
=
TestOptions
.
DebugDll
,
targetFramework
:
=
TargetFramework
.
NetStandardLatest
,
references
:
=
{
csCompilation
})
Dim
validator
=
Sub
(
m
As
ModuleSymbol
)
Dim
c1
=
m
.
GlobalNamespace
.
GetTypeMember
(
"C1"
)
Dim
c2
=
m
.
GlobalNamespace
.
GetTypeMember
(
"C2"
)
Dim
i1
=
c1
.
Interfaces
.
Single
()
Dim
i2
=
i1
.
ContainingModule
.
GlobalNamespace
.
GetTypeMember
(
"I2"
)
Dim
i1WinRT
=
i1
.
GetMember
(
Of
EventSymbol
)(
"WinRT"
)
Dim
i2WinRT
=
DirectCast
(
i2
.
GetMembers
(
"I1.WinRT"
).
Single
(),
EventSymbol
)
Assert
.
True
(
i1WinRT
.
IsWindowsRuntimeEvent
)
Assert
.
True
(
i2WinRT
.
IsWindowsRuntimeEvent
)
Assert
.
Same
(
c1
.
GetMember
(
Of
EventSymbol
)(
"E1"
),
c1
.
FindImplementationForInterfaceMember
(
i1WinRT
))
Assert
.
Same
(
c2
.
GetMember
(
Of
EventSymbol
)(
"E2"
),
c2
.
FindImplementationForInterfaceMember
(
i1WinRT
))
Assert
.
Null
(
i2
.
FindImplementationForInterfaceMember
(
i1WinRT
))
Assert
.
Null
(
i2
.
FindImplementationForInterfaceMember
(
i1WinRT
.
AddMethod
))
Assert
.
Null
(
i2
.
FindImplementationForInterfaceMember
(
i1WinRT
.
RemoveMethod
))
Assert
.
Same
(
i1WinRT
,
i2WinRT
.
ExplicitInterfaceImplementations
.
Single
())
Assert
.
Same
(
i1WinRT
.
AddMethod
,
i2WinRT
.
AddMethod
.
ExplicitInterfaceImplementations
.
Single
())
Assert
.
Same
(
i1WinRT
.
RemoveMethod
,
i2WinRT
.
RemoveMethod
.
ExplicitInterfaceImplementations
.
Single
())
End
Sub
CompileAndVerify
(
comp1
,
verify
:
=
VerifyOnMonoOrCoreClr
,
sourceSymbolValidator
:
=
validator
,
symbolValidator
:
=
validator
)
End
Sub
End
Class
End
Namespace
...
...
src/Test/Utilities/Portable/Mocks/TestReferences.cs
浏览文件 @
8ae9f841
...
...
@@ -334,6 +334,11 @@ public static class NetCoreApp30
()
=>
AssemblyMetadata
.
CreateFromImage
(
TestResources
.
NetFX
.
netcoreapp30
.
System_Linq_Expressions
).
GetReference
(
display
:
"System.Linq.Expressions.dll (netcoreapp 3.0 ref)"
),
LazyThreadSafetyMode
.
PublicationOnly
);
public
static
PortableExecutableReference
SystemLinqExpressionsRef
=>
s_systemLinqExpressions
.
Value
;
private
static
readonly
Lazy
<
PortableExecutableReference
>
s_system_Runtime_InteropServices_WindowsRuntime
=
new
Lazy
<
PortableExecutableReference
>(
()
=>
AssemblyMetadata
.
CreateFromImage
(
TestResources
.
NetFX
.
netcoreapp30
.
System_Runtime_InteropServices_WindowsRuntime
).
GetReference
(
display
:
"System_Runtime_InteropServices_WindowsRuntime.dll (netcoreapp 3.0)"
),
LazyThreadSafetyMode
.
PublicationOnly
);
public
static
PortableExecutableReference
SystemRuntimeInteropServicesWindowsRuntimeRef
=>
s_system_Runtime_InteropServices_WindowsRuntime
.
Value
;
}
public
static
class
Net461
...
...
src/Test/Utilities/Portable/TargetFrameworkUtil.cs
浏览文件 @
8ae9f841
...
...
@@ -90,7 +90,9 @@ public static class TargetFrameworkUtil
public
static
ImmutableArray
<
MetadataReference
>
Mscorlib461References
=>
ImmutableArray
.
Create
<
MetadataReference
>(
Net461
.
mscorlibRef
);
public
static
ImmutableArray
<
MetadataReference
>
Mscorlib461ExtendedReferences
=>
ImmutableArray
.
Create
<
MetadataReference
>(
Net461
.
mscorlibRef
,
Net461
.
SystemRef
,
Net461
.
SystemCoreRef
,
Net461
.
SystemValueTupleRef
,
Net461
.
SystemRuntimeRef
,
Net461
.
netstandardRef
);
public
static
ImmutableArray
<
MetadataReference
>
NetStandard20References
=>
ImmutableArray
.
Create
<
MetadataReference
>(
NetStandard20
.
NetStandard
,
NetStandard20
.
MscorlibRef
,
NetStandard20
.
SystemRuntimeRef
,
NetStandard20
.
SystemCoreRef
,
NetStandard20
.
SystemDynamicRuntimeRef
);
public
static
ImmutableArray
<
MetadataReference
>
NetCoreApp30References
=>
ImmutableArray
.
Create
<
MetadataReference
>(
NetCoreApp30
.
NetStandard
,
NetCoreApp30
.
MscorlibRef
,
NetCoreApp30
.
SystemRuntimeRef
,
NetCoreApp30
.
SystemCollectionsRef
,
NetCoreApp30
.
SystemCoreRef
,
NetCoreApp30
.
SystemDynamicRuntimeRef
,
NetCoreApp30
.
SystemConsoleRef
,
NetCoreApp30
.
SystemLinqRef
,
NetCoreApp30
.
SystemLinqExpressionsRef
);
public
static
ImmutableArray
<
MetadataReference
>
NetCoreApp30References
=>
ImmutableArray
.
Create
<
MetadataReference
>(
NetCoreApp30
.
NetStandard
,
NetCoreApp30
.
MscorlibRef
,
NetCoreApp30
.
SystemRuntimeRef
,
NetCoreApp30
.
SystemCollectionsRef
,
NetCoreApp30
.
SystemCoreRef
,
NetCoreApp30
.
SystemDynamicRuntimeRef
,
NetCoreApp30
.
SystemConsoleRef
,
NetCoreApp30
.
SystemLinqRef
,
NetCoreApp30
.
SystemLinqExpressionsRef
,
NetCoreApp30
.
SystemThreadingTasksRef
,
NetCoreApp30
.
SystemRuntimeInteropServicesWindowsRuntimeRef
);
public
static
ImmutableArray
<
MetadataReference
>
WinRTReferences
=>
ImmutableArray
.
Create
(
TestBase
.
WinRtRefs
);
public
static
ImmutableArray
<
MetadataReference
>
StandardReferences
=>
RuntimeUtilities
.
IsCoreClrRuntime
?
NetStandard20References
:
Mscorlib46ExtendedReferences
;
public
static
ImmutableArray
<
MetadataReference
>
StandardLatestReferences
=>
RuntimeUtilities
.
IsCoreClrRuntime
?
NetCoreApp30References
:
Mscorlib46ExtendedReferences
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录