Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
571a6151
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,发现更多精彩内容 >>
提交
571a6151
编写于
3月 15, 2016
作者:
T
Tomáš Matoušek
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #9755 from tmat/EncNoPiaFix
Report NoPIA EnC errors after all indices have been created
上级
c301f2f2
56f2cba6
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
87 addition
and
42 deletion
+87
-42
src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/EditAndContinueTests.cs
...rp/Test/Emit/Emit/EditAndContinue/EditAndContinueTests.cs
+79
-39
src/Compilers/Core/Portable/Emit/EditAndContinue/DeltaMetadataWriter.cs
...Core/Portable/Emit/EditAndContinue/DeltaMetadataWriter.cs
+1
-2
src/Compilers/Core/Portable/PEWriter/MetadataWriter.cs
src/Compilers/Core/Portable/PEWriter/MetadataWriter.cs
+7
-1
未找到文件。
src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/EditAndContinueTests.cs
浏览文件 @
571a6151
...
...
@@ -6204,12 +6204,11 @@ .maxstack 2
"
);
}
[
WorkItem
(
844472
,
"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/844472"
)]
[
Fact
]
public
void
MethodSignatureWithNoPIAType
()
{
var
sourcePIA
=
@"
using System;
var
sourcePIA
=
@"
using System;
using System.Runtime.InteropServices;
[assembly: ImportedFromTypeLib(""_.dll"")]
[assembly: Guid(""35DB1A6B-D635-4320-A062-28D42920E2A3"")]
...
...
@@ -6218,55 +6217,96 @@ public void MethodSignatureWithNoPIAType()
public interface I
{
}"
;
var
source0
=
@"
class C
var
source0
=
MarkedSource
(
@"
class C
{
static void M(I x)
{
I y = null;
M(null);
System.Console.WriteLine(1);
}
}"
);
var
source1
=
MarkedSource
(
@"
class C
{
static void M(I x)
{
System.Console.WriteLine(2);
}
}"
);
var
compilationPIA
=
CreateCompilationWithMscorlib
(
sourcePIA
,
options
:
TestOptions
.
DebugDll
);
var
referencePIA
=
compilationPIA
.
EmitToImageReference
(
embedInteropTypes
:
true
);
var
compilation0
=
CreateCompilationWithMscorlib
(
source0
.
Tree
,
options
:
ComSafeDebugDll
,
references
:
new
MetadataReference
[]
{
referencePIA
});
var
compilation1
=
compilation0
.
WithSource
(
source1
.
Tree
);
var
method0
=
compilation0
.
GetMember
<
MethodSymbol
>(
"C.M"
);
var
method1
=
compilation1
.
GetMember
<
MethodSymbol
>(
"C.M"
);
var
v0
=
CompileAndVerify
(
compilation0
);
var
md0
=
ModuleMetadata
.
CreateFromImage
(
v0
.
EmittedAssemblyData
);
var
generation0
=
EmitBaseline
.
CreateInitialBaseline
(
md0
,
v0
.
CreateSymReader
().
GetEncMethodDebugInfo
);
var
diff1
=
compilation1
.
EmitDifference
(
generation0
,
ImmutableArray
.
Create
(
new
SemanticEdit
(
SemanticEditKind
.
Update
,
method0
,
method1
,
GetSyntaxMapFromMarkers
(
source0
,
source1
),
preserveLocalVariables
:
true
)));
diff1
.
EmitResult
.
Diagnostics
.
Verify
(
// error CS7096: Cannot continue since the edit includes a reference to an embedded type: 'I'.
Diagnostic
(
ErrorCode
.
ERR_EncNoPIAReference
).
WithArguments
(
"I"
));
}
[
WorkItem
(
844472
,
"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/844472"
)]
[
Fact
]
public
void
LocalSignatureWithNoPIAType
()
{
var
sourcePIA
=
@"
using System;
using System.Runtime.InteropServices;
[assembly: ImportedFromTypeLib(""_.dll"")]
[assembly: Guid(""35DB1A6B-D635-4320-A062-28D42920E2A3"")]
[ComImport()]
[Guid(""35DB1A6B-D635-4320-A062-28D42920E2A4"")]
public interface I
{
}"
;
var
source1
=
@"class C
var
source0
=
MarkedSource
(
@"
class C
{
static void M(I x)
{
I <N:0>y = null</N:0>;
M(null);
}
}"
);
var
source1
=
MarkedSource
(
@"
class C
{
static void M(I x)
{
I
y = null
;
I
<N:0>y = null</N:0>
;
M(x);
}
}"
;
}"
)
;
var
compilationPIA
=
CreateCompilationWithMscorlib
(
sourcePIA
,
options
:
TestOptions
.
DebugDll
);
var
referencePIA
=
compilationPIA
.
EmitToImageReference
(
embedInteropTypes
:
true
);
var
compilation0
=
CreateCompilationWithMscorlib
(
source0
,
options
:
TestOptions
.
DebugDll
,
references
:
new
MetadataReference
[]
{
referencePIA
});
var
compilation1
=
compilation0
.
WithSource
(
source1
);
var
compilation0
=
CreateCompilationWithMscorlib
(
source0
.
Tree
,
options
:
ComSafe
DebugDll
,
references
:
new
MetadataReference
[]
{
referencePIA
});
var
compilation1
=
compilation0
.
WithSource
(
source1
.
Tree
);
var
testData0
=
new
CompilationTestData
();
var
bytes0
=
compilation0
.
EmitToArray
(
testData
:
testData0
);
var
methodData0
=
testData0
.
GetMethodData
(
"C.M"
);
using
(
var
md0
=
ModuleMetadata
.
CreateFromImage
(
bytes0
))
{
var
generation0
=
EmitBaseline
.
CreateInitialBaseline
(
md0
,
methodData0
.
EncDebugInfoProvider
());
var
method0
=
compilation0
.
GetMember
<
MethodSymbol
>(
"C.M"
);
var
method1
=
compilation1
.
GetMember
<
MethodSymbol
>(
"C.M"
);
var
diff1
=
compilation1
.
EmitDifference
(
generation0
,
ImmutableArray
.
Create
(
new
SemanticEdit
(
SemanticEditKind
.
Update
,
method0
,
method1
,
GetEquivalentNodesMap
(
method1
,
method0
),
preserveLocalVariables
:
true
)));
diff1
.
VerifyIL
(
"C.M"
,
@"{
// Code size 11 (0xb)
.maxstack 1
.locals init ([unchanged] V_0,
I V_1) //y
IL_0000: nop
IL_0001: ldnull
IL_0002: stloc.1
IL_0003: ldarg.0
IL_0004: call ""void C.M(I)""
IL_0009: nop
IL_000a: ret
}"
);
}
var
method0
=
compilation0
.
GetMember
<
MethodSymbol
>(
"C.M"
);
var
method1
=
compilation1
.
GetMember
<
MethodSymbol
>(
"C.M"
);
var
v0
=
CompileAndVerify
(
compilation0
);
var
md0
=
ModuleMetadata
.
CreateFromImage
(
v0
.
EmittedAssemblyData
);
var
generation0
=
EmitBaseline
.
CreateInitialBaseline
(
md0
,
v0
.
CreateSymReader
().
GetEncMethodDebugInfo
);
var
diff1
=
compilation1
.
EmitDifference
(
generation0
,
ImmutableArray
.
Create
(
new
SemanticEdit
(
SemanticEditKind
.
Update
,
method0
,
method1
,
GetSyntaxMapFromMarkers
(
source0
,
source1
),
preserveLocalVariables
:
true
)));
diff1
.
EmitResult
.
Diagnostics
.
Verify
(
// (6,16): warning CS0219: The variable 'y' is assigned but its value is never used
Diagnostic
(
ErrorCode
.
WRN_UnreferencedVarAssg
,
"y"
).
WithArguments
(
"y"
),
// error CS7096: Cannot continue since the edit includes a reference to an embedded type: 'I'.
Diagnostic
(
ErrorCode
.
ERR_EncNoPIAReference
).
WithArguments
(
"I"
));
}
/// <summary>
...
...
src/Compilers/Core/Portable/Emit/EditAndContinue/DeltaMetadataWriter.cs
浏览文件 @
571a6151
...
...
@@ -426,9 +426,8 @@ protected override IEnumerable<INamespaceTypeDefinition> GetTopLevelTypes(IModul
return
_changes
.
GetTopLevelTypes
(
this
.
Context
);
}
protected
override
void
CreateIndicesForModule
()
protected
override
void
OnIndicesCreated
()
{
base
.
CreateIndicesForModule
();
var
module
=
(
IPEDeltaAssemblyBuilder
)
this
.
module
;
module
.
OnCreatedIndices
(
this
.
Context
.
Diagnostics
);
}
...
...
src/Compilers/Core/Portable/PEWriter/MetadataWriter.cs
浏览文件 @
571a6151
...
...
@@ -546,6 +546,8 @@ private void CreateIndices()
this
.
module
.
Dispatch
(
_referenceVisitor
);
this
.
CreateMethodBodyReferenceIndex
();
this
.
OnIndicesCreated
();
}
private
void
CreateUserStringIndices
()
...
...
@@ -560,7 +562,7 @@ private void CreateUserStringIndices()
_pseudoStringTokenToTokenMap
=
new
int
[
_pseudoStringTokenToStringMap
.
Count
];
}
pr
otected
virtual
void
CreateIndicesForModule
()
pr
ivate
void
CreateIndicesForModule
()
{
var
nestedTypes
=
new
Queue
<
ITypeDefinition
>();
...
...
@@ -575,6 +577,10 @@ protected virtual void CreateIndicesForModule()
}
}
protected
virtual
void
OnIndicesCreated
()
{
}
private
void
CreateIndicesFor
(
ITypeDefinition
typeDef
,
Queue
<
ITypeDefinition
>
nestedTypes
)
{
_cancellationToken
.
ThrowIfCancellationRequested
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录