未验证 提交 3a3ba133 编写于 作者: A Andy Gocke 提交者: GitHub

Merge pull request #24367 from dotnet/merges/dev15.6.x-to-dev15.7.x-20180122-080019

Merge dev15.6.x to dev15.7.x
......@@ -453,15 +453,21 @@ private BoundStatement UpdateStatement(BoundSpillSequenceBuilder builder, BoundS
bool forceSpill = false,
bool sideEffectsOnly = false)
{
Debug.Assert(!sideEffectsOnly || refKinds.IsDefault);
Debug.Assert(refKinds.IsDefault || refKinds.Length == args.Length);
if (args.Length == 0)
{
return args;
}
var newList = VisitList(args);
Debug.Assert(newList.Length == args.Length);
int lastSpill;
if (forceSpill)
{
lastSpill = newList.Length - 1;
lastSpill = newList.Length;
}
else
{
......@@ -486,22 +492,33 @@ private BoundStatement UpdateStatement(BoundSpillSequenceBuilder builder, BoundS
builder = new BoundSpillSequenceBuilder();
}
var result = ArrayBuilder<BoundExpression>.GetInstance();
for (int i = 0; i <= lastSpill; i++)
var result = ArrayBuilder<BoundExpression>.GetInstance(newList.Length);
// everything up until the last spill must be spilled entirely
for (int i = 0; i < lastSpill; i++)
{
var refKind = refKinds.IsDefault ? RefKind.None : refKinds[i];
var replacement = Spill(builder, newList[i], refKind, sideEffectsOnly);
Debug.Assert(sideEffectsOnly || replacement != null);
if (!sideEffectsOnly)
{
result.Add(replacement);
}
}
for (int i = lastSpill + 1; i < newList.Length; i++)
// the value of the last spill and everything that follows is not spilled
if (lastSpill < newList.Length)
{
result.Add(newList[i]);
var lastSpillNode = (BoundSpillSequenceBuilder)newList[lastSpill];
builder.Include(lastSpillNode);
result.Add(lastSpillNode.Value);
for (int i = lastSpill + 1; i < newList.Length; i++)
{
result.Add(newList[i]);
}
}
return result.ToImmutableAndFree();
......
......@@ -599,7 +599,7 @@ public static async Task<int> F(int[] array)
v.VerifyIL("Test.<F>d__2.System.Runtime.CompilerServices.IAsyncStateMachine.MoveNext", @"
{
// Code size 285 (0x11d)
// Code size 273 (0x111)
.maxstack 5
.locals init (int V_0,
int V_1,
......@@ -634,15 +634,15 @@ .maxstack 5
IL_0029: ldarg.0
IL_002a: ldarg.0
IL_002b: ldfld ""int[] Test.<F>d__2.array""
IL_0030: stfld ""int[] Test.<F>d__2.<>s__5""
IL_0030: stfld ""int[] Test.<F>d__2.<>s__4""
IL_0035: ldarg.0
IL_0036: ldfld ""int[] Test.<F>d__2.<>s__5""
IL_0036: ldfld ""int[] Test.<F>d__2.<>s__4""
IL_003b: ldc.i4.3
IL_003c: ldelem.i4
IL_003d: pop
IL_003e: ldarg.0
IL_003f: ldarg.0
IL_0040: ldfld ""int[] Test.<F>d__2.<>s__5""
IL_0040: ldfld ""int[] Test.<F>d__2.<>s__4""
IL_0045: ldc.i4.3
IL_0046: ldelem.i4
IL_0047: stfld ""int Test.<F>d__2.<>s__2""
......@@ -668,7 +668,7 @@ .maxstack 5
IL_007b: ldloca.s V_4
IL_007d: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.TaskAwaiter<int>, Test.<F>d__2>(ref System.Runtime.CompilerServices.TaskAwaiter<int>, ref Test.<F>d__2)""
IL_0082: nop
IL_0083: leave IL_011c
IL_0083: leave IL_0110
>IL_0088: ldarg.0
IL_0089: ldfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__2.<>u__1""
IL_008e: stloc.3
......@@ -685,55 +685,51 @@ .maxstack 5
IL_00a7: call ""int System.Runtime.CompilerServices.TaskAwaiter<int>.GetResult()""
IL_00ac: stfld ""int Test.<F>d__2.<>s__3""
IL_00b1: ldarg.0
IL_00b2: ldarg.0
IL_00b3: ldfld ""int[] Test.<F>d__2.<>s__5""
IL_00b8: ldc.i4.3
IL_00b9: ldarg.0
IL_00ba: ldfld ""int Test.<F>d__2.<>s__2""
IL_00bf: ldarg.0
IL_00c0: ldfld ""int Test.<F>d__2.<>s__3""
IL_00c5: add
IL_00c6: dup
IL_00c7: stloc.2
IL_00c8: stelem.i4
IL_00c9: ldloc.2
IL_00ca: stfld ""int Test.<F>d__2.<>s__4""
IL_00cf: ldarg.0
IL_00d0: ldfld ""int Test.<F>d__2.<>s__1""
IL_00d5: ldarg.0
IL_00d6: ldfld ""int Test.<F>d__2.<>s__4""
IL_00db: ldc.i4.4
IL_00dc: call ""int Test.H(int, int, int)""
IL_00e1: pop
IL_00e2: ldarg.0
IL_00e3: ldnull
IL_00e4: stfld ""int[] Test.<F>d__2.<>s__5""
-IL_00e9: ldc.i4.1
IL_00ea: stloc.1
IL_00eb: leave.s IL_0107
IL_00b2: ldfld ""int Test.<F>d__2.<>s__1""
IL_00b7: ldarg.0
IL_00b8: ldfld ""int[] Test.<F>d__2.<>s__4""
IL_00bd: ldc.i4.3
IL_00be: ldarg.0
IL_00bf: ldfld ""int Test.<F>d__2.<>s__2""
IL_00c4: ldarg.0
IL_00c5: ldfld ""int Test.<F>d__2.<>s__3""
IL_00ca: add
IL_00cb: dup
IL_00cc: stloc.2
IL_00cd: stelem.i4
IL_00ce: ldloc.2
IL_00cf: ldc.i4.4
IL_00d0: call ""int Test.H(int, int, int)""
IL_00d5: pop
IL_00d6: ldarg.0
IL_00d7: ldnull
IL_00d8: stfld ""int[] Test.<F>d__2.<>s__4""
-IL_00dd: ldc.i4.1
IL_00de: stloc.1
IL_00df: leave.s IL_00fb
}
catch System.Exception
{
~IL_00ed: stloc.s V_5
IL_00ef: ldarg.0
IL_00f0: ldc.i4.s -2
IL_00f2: stfld ""int Test.<F>d__2.<>1__state""
IL_00f7: ldarg.0
IL_00f8: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__2.<>t__builder""
IL_00fd: ldloc.s V_5
IL_00ff: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetException(System.Exception)""
IL_0104: nop
IL_0105: leave.s IL_011c
~IL_00e1: stloc.s V_5
IL_00e3: ldarg.0
IL_00e4: ldc.i4.s -2
IL_00e6: stfld ""int Test.<F>d__2.<>1__state""
IL_00eb: ldarg.0
IL_00ec: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__2.<>t__builder""
IL_00f1: ldloc.s V_5
IL_00f3: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetException(System.Exception)""
IL_00f8: nop
IL_00f9: leave.s IL_0110
}
-IL_0107: ldarg.0
IL_0108: ldc.i4.s -2
IL_010a: stfld ""int Test.<F>d__2.<>1__state""
~IL_010f: ldarg.0
IL_0110: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__2.<>t__builder""
IL_0115: ldloc.1
IL_0116: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetResult(int)""
IL_011b: nop
IL_011c: ret
-IL_00fb: ldarg.0
IL_00fc: ldc.i4.s -2
IL_00fe: stfld ""int Test.<F>d__2.<>1__state""
~IL_0103: ldarg.0
IL_0104: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__2.<>t__builder""
IL_0109: ldloc.1
IL_010a: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetResult(int)""
IL_010f: nop
IL_0110: ret
}", sequencePoints: "Test+<F>d__2.MoveNext");
}
......@@ -766,22 +762,21 @@ public static async Task<int> F(int[] array)
v.VerifyIL("Test.<F>d__2.System.Runtime.CompilerServices.IAsyncStateMachine.MoveNext", @"
{
// Code size 260 (0x104)
.maxstack 4
// Code size 251 (0xfb)
.maxstack 5
.locals init (int V_0,
int V_1,
int V_2,
int V_3,
int V_4,
System.Runtime.CompilerServices.TaskAwaiter<int> V_5,
System.Exception V_6)
System.Runtime.CompilerServices.TaskAwaiter<int> V_4,
System.Exception V_5)
~IL_0000: ldarg.0
IL_0001: ldfld ""int Test.<F>d__2.<>1__state""
IL_0006: stloc.0
.try
{
~IL_0007: ldloc.0
IL_0008: brfalse.s IL_0082
IL_0008: brfalse.s IL_007d
-IL_000a: ldarg.0
IL_000b: ldarg.0
IL_000c: ldfld ""int[] Test.<F>d__2.array""
......@@ -792,108 +787,105 @@ .maxstack 4
IL_0019: ldc.i4.2
IL_001a: add
IL_001b: dup
IL_001c: stloc.s V_4
IL_001e: stind.i4
IL_001f: ldloc.s V_4
IL_0021: stfld ""int Test.<F>d__2.<>7__wrap1""
IL_0026: ldarg.0
IL_0027: ldarg.0
IL_0028: ldfld ""int[] Test.<F>d__2.array""
IL_002d: stfld ""int[] Test.<F>d__2.<>7__wrap3""
IL_0032: ldarg.0
IL_0033: ldfld ""int[] Test.<F>d__2.<>7__wrap3""
IL_0038: ldc.i4.3
IL_0039: ldelem.i4
IL_003a: pop
IL_003b: ldarg.0
IL_003c: ldarg.0
IL_003d: ldfld ""int[] Test.<F>d__2.<>7__wrap3""
IL_0042: ldc.i4.3
IL_0043: ldelem.i4
IL_0044: stfld ""int Test.<F>d__2.<>7__wrap2""
IL_0049: call ""System.Threading.Tasks.Task<int> Test.G()""
IL_004e: callvirt ""System.Runtime.CompilerServices.TaskAwaiter<int> System.Threading.Tasks.Task<int>.GetAwaiter()""
IL_0053: stloc.s V_5
~IL_0055: ldloca.s V_5
IL_0057: call ""bool System.Runtime.CompilerServices.TaskAwaiter<int>.IsCompleted.get""
IL_005c: brtrue.s IL_009f
IL_005e: ldarg.0
IL_005f: ldc.i4.0
IL_0060: dup
IL_0061: stloc.0
IL_0062: stfld ""int Test.<F>d__2.<>1__state""
<IL_0067: ldarg.0
IL_0068: ldloc.s V_5
IL_006a: stfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__2.<>u__1""
IL_006f: ldarg.0
IL_0070: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__2.<>t__builder""
IL_0075: ldloca.s V_5
IL_0077: ldarg.0
IL_0078: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.TaskAwaiter<int>, Test.<F>d__2>(ref System.Runtime.CompilerServices.TaskAwaiter<int>, ref Test.<F>d__2)""
IL_007d: leave IL_0103
>IL_0082: ldarg.0
IL_0083: ldfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__2.<>u__1""
IL_0088: stloc.s V_5
IL_008a: ldarg.0
IL_008b: ldflda ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__2.<>u__1""
IL_0090: initobj ""System.Runtime.CompilerServices.TaskAwaiter<int>""
IL_0096: ldarg.0
IL_0097: ldc.i4.m1
IL_0098: dup
IL_0099: stloc.0
IL_009a: stfld ""int Test.<F>d__2.<>1__state""
IL_009f: ldloca.s V_5
IL_00a1: call ""int System.Runtime.CompilerServices.TaskAwaiter<int>.GetResult()""
IL_00a6: stloc.2
IL_00a7: ldarg.0
IL_00a8: ldfld ""int[] Test.<F>d__2.<>7__wrap3""
IL_00ad: ldc.i4.3
IL_00ae: ldarg.0
IL_00af: ldfld ""int Test.<F>d__2.<>7__wrap2""
IL_00b4: ldloc.2
IL_00b5: add
IL_00b6: dup
IL_00b7: stloc.s V_4
IL_001c: stloc.3
IL_001d: stind.i4
IL_001e: ldloc.3
IL_001f: stfld ""int Test.<F>d__2.<>7__wrap1""
IL_0024: ldarg.0
IL_0025: ldarg.0
IL_0026: ldfld ""int[] Test.<F>d__2.array""
IL_002b: stfld ""int[] Test.<F>d__2.<>7__wrap3""
IL_0030: ldarg.0
IL_0031: ldfld ""int[] Test.<F>d__2.<>7__wrap3""
IL_0036: ldc.i4.3
IL_0037: ldelem.i4
IL_0038: pop
IL_0039: ldarg.0
IL_003a: ldarg.0
IL_003b: ldfld ""int[] Test.<F>d__2.<>7__wrap3""
IL_0040: ldc.i4.3
IL_0041: ldelem.i4
IL_0042: stfld ""int Test.<F>d__2.<>7__wrap2""
IL_0047: call ""System.Threading.Tasks.Task<int> Test.G()""
IL_004c: callvirt ""System.Runtime.CompilerServices.TaskAwaiter<int> System.Threading.Tasks.Task<int>.GetAwaiter()""
IL_0051: stloc.s V_4
~IL_0053: ldloca.s V_4
IL_0055: call ""bool System.Runtime.CompilerServices.TaskAwaiter<int>.IsCompleted.get""
IL_005a: brtrue.s IL_009a
IL_005c: ldarg.0
IL_005d: ldc.i4.0
IL_005e: dup
IL_005f: stloc.0
IL_0060: stfld ""int Test.<F>d__2.<>1__state""
<IL_0065: ldarg.0
IL_0066: ldloc.s V_4
IL_0068: stfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__2.<>u__1""
IL_006d: ldarg.0
IL_006e: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__2.<>t__builder""
IL_0073: ldloca.s V_4
IL_0075: ldarg.0
IL_0076: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.TaskAwaiter<int>, Test.<F>d__2>(ref System.Runtime.CompilerServices.TaskAwaiter<int>, ref Test.<F>d__2)""
IL_007b: leave.s IL_00fa
>IL_007d: ldarg.0
IL_007e: ldfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__2.<>u__1""
IL_0083: stloc.s V_4
IL_0085: ldarg.0
IL_0086: ldflda ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__2.<>u__1""
IL_008b: initobj ""System.Runtime.CompilerServices.TaskAwaiter<int>""
IL_0091: ldarg.0
IL_0092: ldc.i4.m1
IL_0093: dup
IL_0094: stloc.0
IL_0095: stfld ""int Test.<F>d__2.<>1__state""
IL_009a: ldloca.s V_4
IL_009c: call ""int System.Runtime.CompilerServices.TaskAwaiter<int>.GetResult()""
IL_00a1: stloc.2
IL_00a2: ldarg.0
IL_00a3: ldfld ""int Test.<F>d__2.<>7__wrap1""
IL_00a8: ldarg.0
IL_00a9: ldfld ""int[] Test.<F>d__2.<>7__wrap3""
IL_00ae: ldc.i4.3
IL_00af: ldarg.0
IL_00b0: ldfld ""int Test.<F>d__2.<>7__wrap2""
IL_00b5: ldloc.2
IL_00b6: add
IL_00b7: dup
IL_00b8: stloc.3
IL_00b9: stelem.i4
IL_00ba: ldloc.s V_4
IL_00bc: stloc.3
IL_00bd: ldarg.0
IL_00be: ldfld ""int Test.<F>d__2.<>7__wrap1""
IL_00c3: ldloc.3
IL_00c4: ldc.i4.4
IL_00c5: call ""int Test.H(int, int, int)""
IL_00ca: pop
IL_00cb: ldarg.0
IL_00cc: ldnull
IL_00cd: stfld ""int[] Test.<F>d__2.<>7__wrap3""
-IL_00d2: ldc.i4.1
IL_00d3: stloc.1
IL_00d4: leave.s IL_00ef
IL_00ba: ldloc.3
IL_00bb: ldc.i4.4
IL_00bc: call ""int Test.H(int, int, int)""
IL_00c1: pop
IL_00c2: ldarg.0
IL_00c3: ldnull
IL_00c4: stfld ""int[] Test.<F>d__2.<>7__wrap3""
-IL_00c9: ldc.i4.1
IL_00ca: stloc.1
IL_00cb: leave.s IL_00e6
}
catch System.Exception
{
~IL_00d6: stloc.s V_6
IL_00d8: ldarg.0
IL_00d9: ldc.i4.s -2
IL_00db: stfld ""int Test.<F>d__2.<>1__state""
IL_00e0: ldarg.0
IL_00e1: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__2.<>t__builder""
IL_00e6: ldloc.s V_6
IL_00e8: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetException(System.Exception)""
IL_00ed: leave.s IL_0103
~IL_00cd: stloc.s V_5
IL_00cf: ldarg.0
IL_00d0: ldc.i4.s -2
IL_00d2: stfld ""int Test.<F>d__2.<>1__state""
IL_00d7: ldarg.0
IL_00d8: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__2.<>t__builder""
IL_00dd: ldloc.s V_5
IL_00df: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetException(System.Exception)""
IL_00e4: leave.s IL_00fa
}
-IL_00ef: ldarg.0
IL_00f0: ldc.i4.s -2
IL_00f2: stfld ""int Test.<F>d__2.<>1__state""
~IL_00f7: ldarg.0
IL_00f8: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__2.<>t__builder""
IL_00fd: ldloc.1
IL_00fe: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetResult(int)""
IL_0103: ret
-IL_00e6: ldarg.0
IL_00e7: ldc.i4.s -2
IL_00e9: stfld ""int Test.<F>d__2.<>1__state""
~IL_00ee: ldarg.0
IL_00ef: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__2.<>t__builder""
IL_00f4: ldloc.1
IL_00f5: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetResult(int)""
IL_00fa: ret
}", sequencePoints: "Test+<F>d__2.MoveNext");
}
[Fact]
public void SpillSequencesInConditionalExpression1()
{
......@@ -981,9 +973,8 @@ public static async Task<int> F(int[] array)
"<>s__5",
"<>s__6",
"<>s__7",
"<>s__8",
"<>u__1",
"<>s__9"
"<>s__8"
}, module.GetFieldNames("C.<F>d__3"));
});
}
......@@ -3225,5 +3216,82 @@ static void Main(string[] args)
var expected = new bool[] { false, true, false, true, false }.Aggregate("", (str, next) => str += $"{next}{Environment.NewLine}");
var v = CompileAndVerify(source, expected);
}
[Fact]
[WorkItem(17706, "https://github.com/dotnet/roslyn/issues/17706")]
public void SpillAwaitBeforeRefReordered()
{
string source = @"
using System.Threading.Tasks;
public class C
{
private static int i;
static ref int P => ref i;
static void Assign(ref int first, int second)
{
first = second;
}
public static async Task M(Task<int> t)
{
// OK: await goes before the ref
Assign(second: await t, first: ref P);
}
public static void Main()
{
M(Task.FromResult(42)).Wait();
System.Console.WriteLine(i);
}
}
";
var v = CompileAndVerify(source, "42");
}
[Fact]
[WorkItem(17706, "https://github.com/dotnet/roslyn/issues/17706")]
public void SpillRefBeforeAwaitReordered()
{
string source = @"
using System.Threading.Tasks;
public class C
{
private static int i;
static ref int P => ref i;
static void Assign(int first, ref int second)
{
second = first;
}
public static async Task M(Task<int> t)
{
// ERROR: await goes after the ref
Assign(second: ref P, first: await t);
}
public static void Main()
{
M(Task.FromResult(42)).Wait();
System.Console.WriteLine(i);
}
}
";
var comp = CreateCompilationWithMscorlib46(source, options: TestOptions.ReleaseExe);
comp.VerifyEmitDiagnostics(
// (18,28): error CS8178: 'await' cannot be used in an expression containing a call to 'C.P.get' because it returns by reference
// Assign(second: ref P, first: await t);
Diagnostic(ErrorCode.ERR_RefReturningCallAndAwait, "P").WithArguments("C.P.get").WithLocation(18, 28)
);
}
}
}
......@@ -7397,7 +7397,7 @@ class Program
{
static void Main(string[] args)
{
var obj1 = new MyObject1 { MyDate = DateTime.Parse(""2017-11-13T14:25:00Z"") };
var obj1 = new MyObject1 { MyDate = new DateTime(636461511000000000L) };
var obj2 = new MyObject2<MyObject1>(obj1);
System.Console.WriteLine(obj1.MyDate.Ticks);
......@@ -7448,7 +7448,7 @@ class Program
{
static void Main(string[] args)
{
var obj1 = new MyObject1 { MyDate = DateTime.Parse(""2017-11-13T14:25:00Z"") };
var obj1 = new MyObject1 { MyDate = new DateTime(636461511000000000L) };
var obj2 = new MyObject2<MyObject1>(obj1);
System.Console.WriteLine(obj1.MyDate.Ticks);
......
......@@ -1737,15 +1737,24 @@ void Write(ref int y)
{
Console.WriteLine(y);
}
void Write(ref int y, int z)
{
Console.WriteLine(z);
}
async Task TestMethod()
{
// this is OK. `ref` is not spilled.
Write(ref Save(await Task.FromResult(0)));
// ERROR. `ref` is spilled because it must survive until after the second `await.
Write(ref Save(await Task.FromResult(0)), await Task.FromResult(1));
}
}";
CreateCompilationWithMscorlib45(code).VerifyEmitDiagnostics(
// (18,24): error CS8178: 'await' cannot be used in an expression containing a call to 'TestClass.Save(int)' because it returns by reference
// Write(ref Save(await Task.FromResult(0)));
Diagnostic(ErrorCode.ERR_RefReturningCallAndAwait, "await Task.FromResult(0)").WithArguments("TestClass.Save(int)").WithLocation(18, 24));
// (26,51): error CS8178: 'await' cannot be used in an expression containing a call to 'TestClass.Save(int)' because it returns by reference
// Write(ref Save(await Task.FromResult(0)), await Task.FromResult(1));
Diagnostic(ErrorCode.ERR_RefReturningCallAndAwait, "await Task.FromResult(1)").WithArguments("TestClass.Save(int)").WithLocation(26, 51)
);
}
[Fact]
......
......@@ -2325,6 +2325,136 @@ BC31143: Method 'Public Overloads ByRef Function F() As Integer' does not have a
</expected>)
End Sub
<Fact>
<WorkItem(17706, "https://github.com/dotnet/roslyn/issues/17706")>
Public Sub SpillingByRefCall_NoSpilling()
Dim comp1 = CreateCSharpCompilation(
"
using System;
public class TestClass
{
int x = 0;
public ref int Save(int y)
{
x = y;
return ref x;
}
public void Write(ref int y)
{
Console.WriteLine(y);
}
public void Write(ref int y, int z)
{
Console.WriteLine(y);
}
}")
comp1.VerifyDiagnostics()
Dim comp2 = CreateVisualBasicCompilation(
Nothing,
"
Imports System.Threading.Tasks
Module Module1
Sub Main()
TestMethod().Wait()
End Sub
Async Function TestMethod() As Task
Dim inst = New TestClass
' this is OK. `ref` call is not spilled.
' prints: 10 (last value)
inst.Write(inst.Save(Await Task.FromResult(10)))
' this is OK. `ref` call is not spilled.
' prints: 22 (last value)
inst.Write(inst.Save(Await Task.FromResult(20)), inst.Save(22))
End Function
End Module
",
referencedCompilations:={comp1},
referencedAssemblies:=LatestVbReferences,
compilationOptions:=TestOptions.DebugExe)
comp2.AssertTheseDiagnostics()
Dim verifier = CompileAndVerify(comp2, expectedOutput:=
"
10
22
")
verifier.VerifyDiagnostics()
End Sub
<Fact(Skip:="https://github.com/dotnet/roslyn/issues/24275")>
<WorkItem(24275, "https://github.com/dotnet/roslyn/issues/24275")>
Public Sub SpillingByRefCall_Spilling()
Dim comp1 = CreateCSharpCompilation(
"
using System;
public class TestClass
{
int x = 0;
public ref int Save(int y)
{
x = y;
return ref x;
}
public void Write(ref int y)
{
Console.WriteLine(y);
}
public void Write(ref int y, int z)
{
Console.WriteLine(y);
}
}")
comp1.VerifyDiagnostics()
Dim comp2 = CreateVisualBasicCompilation(
Nothing,
"
Imports System.Threading.Tasks
Module Module1
Sub Main()
TestMethod().Wait()
End Sub
Async Function TestMethod() As Task
Dim inst = New TestClass
' ERROR?
' currently `ref` is spilled 'by-value' and assert fires.
inst.Write(inst.Save(Await Task.FromResult(30)), inst.Save(Await Task.FromResult(33)))
End Function
End Module
",
referencedCompilations:={comp1},
referencedAssemblies:=LatestVbReferences,
compilationOptions:=TestOptions.DebugExe)
comp2.AssertTheseDiagnostics()
Dim verifier = CompileAndVerify(comp2, expectedOutput:=
"
??
")
verifier.VerifyDiagnostics()
End Sub
End Class
End Namespace
......@@ -9653,7 +9653,7 @@ Test
<file name="a.vb">
Module Module1
Sub Main()
Dim obj1 As New MyObject1 With {.MyDate = CDate("2017-11-13T14:25:00Z")}
Dim obj1 As New MyObject1 With {.MyDate = New Date(636461511000000000L)}
Dim obj2 As New MyObject2(Of MyObject1)(obj1)
System.Console.WriteLine(obj1.MyDate.Ticks)
......@@ -9709,7 +9709,7 @@ False
<file name="a.vb">
Module Module1
Sub Main()
Dim obj1 As New MyObject1 With {.MyDate = CDate("2017-11-13T14:25:00Z")}
Dim obj1 As New MyObject1 With {.MyDate = New Date(636461511000000000L)}
Dim obj2 As New MyObject2(Of MyObject1)(obj1)
System.Console.WriteLine(obj1.MyDate.Ticks)
......
......@@ -1924,6 +1924,56 @@ void M()
await VerifyItemExistsAsync(markup, "String");
}
[Fact, Trait(Traits.Feature, Traits.Features.Completion)]
[WorkItem(24326, "https://github.com/dotnet/roslyn/issues/24326")]
public async Task AfterInInLambda()
{
var markup = @"
using System;
class C
{
void M()
{
Func<int, int> f = (in $$
}
}
";
await VerifyItemExistsAsync(markup, "String");
}
[Fact, Trait(Traits.Feature, Traits.Features.Completion)]
[WorkItem(24326, "https://github.com/dotnet/roslyn/issues/24326")]
public async Task AfterInInMethodDeclaration()
{
var markup = @"
using System;
class C
{
void M(in $$)
{
}
}
";
await VerifyItemExistsAsync(markup, "String");
}
[Fact, Trait(Traits.Feature, Traits.Features.Completion)]
[WorkItem(24326, "https://github.com/dotnet/roslyn/issues/24326")]
public async Task VariableAfterInInInvocation()
{
var markup = @"
using System;
class C
{
void M(in String parameter)
{
M(in $$
}
}
";
await VerifyItemExistsAsync(markup, "parameter");
}
[WorkItem(539217, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539217")]
[Fact, Trait(Traits.Feature, Traits.Features.Completion)]
public async Task NestedType1()
......
......@@ -34,7 +34,10 @@ public static async Task<RemoteHostClient> CreateAsync(Workspace workspace, bool
// make sure connection is done right
var current = $"VS ({Process.GetCurrentProcess().Id})";
var telemetrySession = default(string);
var host = await instance._rpc.InvokeAsync<string>(nameof(IRemoteHostService.Connect), current, telemetrySession).ConfigureAwait(false);
var uiCultureLCIDE = 0;
var cultureLCID = 0;
var host = await instance._rpc.InvokeAsync<string>(nameof(IRemoteHostService.Connect), current, uiCultureLCIDE, cultureLCID, telemetrySession).ConfigureAwait(false);
// TODO: change this to non fatal watson and make VS to use inproc implementation
Contract.ThrowIfFalse(host == current.ToString());
......
......@@ -2,6 +2,7 @@
using System;
using System.ComponentModel.Composition;
using System.Diagnostics;
using System.Runtime.InteropServices;
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
using Microsoft.CodeAnalysis.ErrorReporting;
......@@ -30,6 +31,11 @@ namespace Microsoft.VisualStudio.LanguageServices.Implementation.Experimentation
/// 'Never show this again', this will persist for the life of the VS instance, and does not need to be manually disposed
/// in that case.
/// </remarks>
/// <para>
/// We've written this in a generic mechanism we can extend to any extension as we know of them,
/// but at this time ReSharper is the only one we know of that has this behavior.
/// If we find other extensions that do this in the future, we'll re-use this same mechanism
/// </para>
[Export(typeof(IExperiment))]
internal sealed class KeybindingResetDetector : ForegroundThreadAffinitizedObject, IExperiment, IOleCommandTarget
{
......@@ -37,6 +43,7 @@ internal sealed class KeybindingResetDetector : ForegroundThreadAffinitizedObjec
private const string InternalFlightName = "keybindgoldbarint";
private const string ExternalFlightName = "keybindgoldbarext";
private const string KeybindingsFwLink = "https://go.microsoft.com/fwlink/?linkid=864209";
private const string ReSharperExtensionName = "ReSharper Ultimate";
// Resharper commands and package
private const uint ResumeId = 707;
......@@ -181,25 +188,14 @@ private void ShowGoldBar()
_infoBarOpen = true;
string message;
if (_experimentationService.IsExperimentEnabled(InternalFlightName))
{
message = ServicesVSResources.We_noticed_you_suspended_ReSharper_Ultimate_Restore_Visual_Studio_keybindings_to_continue_to_navigate_and_refactor;
}
else if (_experimentationService.IsExperimentEnabled(ExternalFlightName))
{
message = ServicesVSResources.Your_keybindings_are_no_longer_mapped_to_Visual_Studio_commands;
}
else
{
// Should never have gotten to checking this if one of the flights isn't enabled.
throw ExceptionUtilities.Unreachable;
}
Debug.Assert(_experimentationService.IsExperimentEnabled(InternalFlightName) ||
_experimentationService.IsExperimentEnabled(ExternalFlightName));
string message = ServicesVSResources.Disabling_the_extension_0_unbound_your_keyboard_bindings;
KeybindingsResetLogger.Log("InfoBarShown");
var infoBarService = _workspace.Services.GetRequiredService<IInfoBarService>();
infoBarService.ShowInfoBarInGlobalView(
message,
string.Format(message, ReSharperExtensionName),
new InfoBarUI(title: ServicesVSResources.Restore_Visual_Studio_keybindings,
kind: InfoBarUI.UIKind.Button,
action: RestoreVsKeybindings),
......
......@@ -2,6 +2,7 @@
using System;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
......@@ -93,9 +94,12 @@ public static async Task<ServiceHubRemoteHostClient> CreateWorkerAsync(Workspace
workspace, primary.Logger, await RequestServiceAsync(primary, WellKnownServiceHubServices.SnapshotService, hostGroup, timeout, cancellationToken).ConfigureAwait(false));
client = new ServiceHubRemoteHostClient(workspace, primary, hostGroup, new ReferenceCountedDisposable<RemotableDataJsonRpc>(remotableDataRpc), remoteHostStream);
var uiCultureLCID = CultureInfo.CurrentUICulture.LCID;
var cultureLCID = CultureInfo.CurrentCulture.LCID;
// make sure connection is done right
var host = await client._rpc.InvokeWithCancellationAsync<string>(
nameof(IRemoteHostService.Connect), new object[] { current, TelemetryService.DefaultSession.SerializeSettings() }, cancellationToken).ConfigureAwait(false);
nameof(IRemoteHostService.Connect), new object[] { current, uiCultureLCID, cultureLCID, TelemetryService.DefaultSession.SerializeSettings() }, cancellationToken).ConfigureAwait(false);
return client;
}
......
......@@ -680,6 +680,15 @@ internal class ServicesVSResources {
}
}
/// <summary>
/// Looks up a localized string similar to Disabling the extension &apos;{0}&apos; unbound your keyboard bindings..
/// </summary>
internal static string Disabling_the_extension_0_unbound_your_keyboard_bindings {
get {
return ResourceManager.GetString("Disabling_the_extension_0_unbound_your_keyboard_bindings", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to DocumentPath is illegal.
/// </summary>
......@@ -2625,16 +2634,6 @@ internal class ServicesVSResources {
}
}
/// <summary>
/// Looks up a localized string similar to We noticed you suspended ‘ReSharper Ultimate’. Restore Visual Studio keybindings to continue to navigate and refactor..
/// </summary>
internal static string We_noticed_you_suspended_ReSharper_Ultimate_Restore_Visual_Studio_keybindings_to_continue_to_navigate_and_refactor {
get {
return ResourceManager.GetString("We_noticed_you_suspended_ReSharper_Ultimate_Restore_Visual_Studio_keybindings_to_" +
"continue_to_navigate_and_refactor", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to When generating properties:.
/// </summary>
......@@ -2688,14 +2687,5 @@ internal class ServicesVSResources {
return ResourceManager.GetString("You_must_select_at_least_one_member", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Your keybindings are no longer mapped to Visual Studio commands..
/// </summary>
internal static string Your_keybindings_are_no_longer_mapped_to_Visual_Studio_commands {
get {
return ResourceManager.GetString("Your_keybindings_are_no_longer_mapped_to_Visual_Studio_commands", resourceCulture);
}
}
}
}
......@@ -992,12 +992,6 @@ Additional information: {1}</value>
<data name="Use_Keybindings_for_extensions" xml:space="preserve">
<value>Use keybindings for ReSharper/IntelliJ/Vim/etc.</value>
</data>
<data name="Your_keybindings_are_no_longer_mapped_to_Visual_Studio_commands" xml:space="preserve">
<value>Your keybindings are no longer mapped to Visual Studio commands.</value>
</data>
<data name="We_noticed_you_suspended_ReSharper_Ultimate_Restore_Visual_Studio_keybindings_to_continue_to_navigate_and_refactor" xml:space="preserve">
<value>We noticed you suspended ‘ReSharper Ultimate’. Restore Visual Studio keybindings to continue to navigate and refactor.</value>
</data>
<data name="Enable_navigation_to_decompiled_sources" xml:space="preserve">
<value>Enable navigation to decompiled sources (experimental)</value>
</data>
......@@ -1015,7 +1009,11 @@ I agree to all of the foregoing:</value>
<data name="Decompiler_Legal_Notice_Title" xml:space="preserve">
<value>Decompiler Legal Notice</value>
</data>
<data name="Disabling_the_extension_0_unbound_your_keyboard_bindings" xml:space="preserve">
<value>Disabling the extension '{0}' unbound your keyboard bindings.</value>
<comment>0 is an extension name</comment>
</data>
<data name="Code_style_header_use_editor_config" xml:space="preserve">
<value>The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</value>
</data>
</root>
\ No newline at end of file
</root>
......@@ -1457,16 +1457,6 @@ Pro aktuální řešení je povolené zjednodušené načtení řešení. Jeho z
<target state="translated">Použijte vazby kláves pro ReSharper/IntelliJ/Vim/etc.</target>
<note />
</trans-unit>
<trans-unit id="Your_keybindings_are_no_longer_mapped_to_Visual_Studio_commands">
<source>Your keybindings are no longer mapped to Visual Studio commands.</source>
<target state="translated">Vaše vazby kláves už nejsou namapované na příkazy sady Visual Studio.</target>
<note />
</trans-unit>
<trans-unit id="We_noticed_you_suspended_ReSharper_Ultimate_Restore_Visual_Studio_keybindings_to_continue_to_navigate_and_refactor">
<source>We noticed you suspended ‘ReSharper Ultimate’. Restore Visual Studio keybindings to continue to navigate and refactor.</source>
<target state="translated">Všimli jsme si, že jste pozastavili ReSharper Ultimate. Pokud chcete pokračovat v navigaci a refaktoringu, obnovte vazby kláves pro Visual Studio.</target>
<note />
</trans-unit>
<trans-unit id="Enable_navigation_to_decompiled_sources">
<source>Enable navigation to decompiled sources (experimental)</source>
<target state="translated">Povolit navigaci na dekompilované zdroje (experimentální)</target>
......@@ -1498,6 +1488,11 @@ Souhlasím se všemi výše uvedenými podmínkami:</target>
<target state="translated">Právní doložka pro dekompilátor</target>
<note />
</trans-unit>
<trans-unit id="Disabling_the_extension_0_unbound_your_keyboard_bindings">
<source>Disabling the extension '{0}' unbound your keyboard bindings.</source>
<target state="new">Disabling the extension '{0}' unbound your keyboard bindings.</target>
<note>0 is an extension name</note>
</trans-unit>
<trans-unit id="Code_style_header_use_editor_config">
<source>The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</source>
<target state="new">The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</target>
......
......@@ -1457,16 +1457,6 @@ Für die aktuelle Projektmappe ist die Option "Lightweight-Ladevorgang für Proj
<target state="translated">Verwenden Sie Tastenzuordnungen für ReSharper/IntelliJ/Vim usw.</target>
<note />
</trans-unit>
<trans-unit id="Your_keybindings_are_no_longer_mapped_to_Visual_Studio_commands">
<source>Your keybindings are no longer mapped to Visual Studio commands.</source>
<target state="translated">Ihre Tastenzuordnungen sind nicht länger Visual Studio-Befehlen zugeordnet.</target>
<note />
</trans-unit>
<trans-unit id="We_noticed_you_suspended_ReSharper_Ultimate_Restore_Visual_Studio_keybindings_to_continue_to_navigate_and_refactor">
<source>We noticed you suspended ‘ReSharper Ultimate’. Restore Visual Studio keybindings to continue to navigate and refactor.</source>
<target state="translated">Wir haben festgestellt, dass Sie "ReSharper Ultimate" angehalten haben. Stellen Sie die Visual Studio-Tastenzuordnungen wieder her, um Navigation und Refactoring fortzusetzen.</target>
<note />
</trans-unit>
<trans-unit id="Enable_navigation_to_decompiled_sources">
<source>Enable navigation to decompiled sources (experimental)</source>
<target state="translated">Aktivieren der Navigation zu dekompilierten Quellen (experimentell)</target>
......@@ -1498,6 +1488,11 @@ Ich stimme allen vorstehenden Bedingungen zu:</target>
<target state="translated">Rechtlicher Hinweis zum Decompiler</target>
<note />
</trans-unit>
<trans-unit id="Disabling_the_extension_0_unbound_your_keyboard_bindings">
<source>Disabling the extension '{0}' unbound your keyboard bindings.</source>
<target state="new">Disabling the extension '{0}' unbound your keyboard bindings.</target>
<note>0 is an extension name</note>
</trans-unit>
<trans-unit id="Code_style_header_use_editor_config">
<source>The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</source>
<target state="new">The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</target>
......
......@@ -1457,16 +1457,6 @@ La opción "Carga de solución ligera" está habilitada para la solución actual
<target state="translated">Use enlaces de teclado para ReSharper/IntelliJ/Vim/etc.</target>
<note />
</trans-unit>
<trans-unit id="Your_keybindings_are_no_longer_mapped_to_Visual_Studio_commands">
<source>Your keybindings are no longer mapped to Visual Studio commands.</source>
<target state="translated">Los enlaces de teclado ya no están asignados a los comandos de Visual Studio.</target>
<note />
</trans-unit>
<trans-unit id="We_noticed_you_suspended_ReSharper_Ultimate_Restore_Visual_Studio_keybindings_to_continue_to_navigate_and_refactor">
<source>We noticed you suspended ‘ReSharper Ultimate’. Restore Visual Studio keybindings to continue to navigate and refactor.</source>
<target state="translated">Hemos observado que ha suspendido "ReSharper Ultimate". Restaure los enlaces de teclado de Visual Studio para seguir navegando y refactorizando.</target>
<note />
</trans-unit>
<trans-unit id="Enable_navigation_to_decompiled_sources">
<source>Enable navigation to decompiled sources (experimental)</source>
<target state="translated">Habilitar la navegación a orígenes decompilados (experimental)</target>
......@@ -1498,6 +1488,11 @@ Estoy de acuerdo con todo lo anterior:</target>
<target state="translated">Aviso legal del Descompilador</target>
<note />
</trans-unit>
<trans-unit id="Disabling_the_extension_0_unbound_your_keyboard_bindings">
<source>Disabling the extension '{0}' unbound your keyboard bindings.</source>
<target state="new">Disabling the extension '{0}' unbound your keyboard bindings.</target>
<note>0 is an extension name</note>
</trans-unit>
<trans-unit id="Code_style_header_use_editor_config">
<source>The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</source>
<target state="new">The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</target>
......
......@@ -1457,16 +1457,6 @@ Informations supplémentaires : {1}</target>
<target state="translated">Utiliser des combinaisons de touches pour ReSharper/IntelliJ/Vim/etc.</target>
<note />
</trans-unit>
<trans-unit id="Your_keybindings_are_no_longer_mapped_to_Visual_Studio_commands">
<source>Your keybindings are no longer mapped to Visual Studio commands.</source>
<target state="translated">Vos combinaisons de touches ne sont plus mappées aux commandes Visual Studio.</target>
<note />
</trans-unit>
<trans-unit id="We_noticed_you_suspended_ReSharper_Ultimate_Restore_Visual_Studio_keybindings_to_continue_to_navigate_and_refactor">
<source>We noticed you suspended ‘ReSharper Ultimate’. Restore Visual Studio keybindings to continue to navigate and refactor.</source>
<target state="translated">Nous avons remarqué que vous avez suspendu 'ReSharper Ultimate'. Restaurez les combinaisons de touches Visual Studio pour continuer à naviguer et à refactoriser.</target>
<note />
</trans-unit>
<trans-unit id="Enable_navigation_to_decompiled_sources">
<source>Enable navigation to decompiled sources (experimental)</source>
<target state="translated">Activer la navigation vers des sources décompilées (expérimental)</target>
......@@ -1498,6 +1488,11 @@ Je suis d'accord avec tout ce qui précède :</target>
<target state="translated">Décompileur - Mention légale</target>
<note />
</trans-unit>
<trans-unit id="Disabling_the_extension_0_unbound_your_keyboard_bindings">
<source>Disabling the extension '{0}' unbound your keyboard bindings.</source>
<target state="new">Disabling the extension '{0}' unbound your keyboard bindings.</target>
<note>0 is an extension name</note>
</trans-unit>
<trans-unit id="Code_style_header_use_editor_config">
<source>The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</source>
<target state="new">The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</target>
......
......@@ -1457,16 +1457,6 @@ L'opzione 'Caricamento leggero soluzioni' è abilitata per la soluzione corrente
<target state="translated">Usa i tasti di scelta rapida per ReSharper/IntelliJ/Vim e così via.</target>
<note />
</trans-unit>
<trans-unit id="Your_keybindings_are_no_longer_mapped_to_Visual_Studio_commands">
<source>Your keybindings are no longer mapped to Visual Studio commands.</source>
<target state="translated">I tasti di scelta rapida non sono più associati a comandi di Visual Studio.</target>
<note />
</trans-unit>
<trans-unit id="We_noticed_you_suspended_ReSharper_Ultimate_Restore_Visual_Studio_keybindings_to_continue_to_navigate_and_refactor">
<source>We noticed you suspended ‘ReSharper Ultimate’. Restore Visual Studio keybindings to continue to navigate and refactor.</source>
<target state="translated">È stato notato che ‘ReSharper Ultimate’ è stato sospeso. Per continuare a esplorare e a eseguire il refactoring, ripristinare i tasti di scelta rapida di Visual Studio.</target>
<note />
</trans-unit>
<trans-unit id="Enable_navigation_to_decompiled_sources">
<source>Enable navigation to decompiled sources (experimental)</source>
<target state="translated">Abilita lo spostamento in origini decompilate (sperimentale)</target>
......@@ -1498,6 +1488,11 @@ L'utente accetta le condizioni sopra riportate:</target>
<target state="translated">Note legali sul decompilatore</target>
<note />
</trans-unit>
<trans-unit id="Disabling_the_extension_0_unbound_your_keyboard_bindings">
<source>Disabling the extension '{0}' unbound your keyboard bindings.</source>
<target state="new">Disabling the extension '{0}' unbound your keyboard bindings.</target>
<note>0 is an extension name</note>
</trans-unit>
<trans-unit id="Code_style_header_use_editor_config">
<source>The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</source>
<target state="new">The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</target>
......
......@@ -1457,16 +1457,6 @@ Additional information: {1}</source>
<target state="translated">ReSharper/IntelliJ/Vim などのキー バインドを使用します。</target>
<note />
</trans-unit>
<trans-unit id="Your_keybindings_are_no_longer_mapped_to_Visual_Studio_commands">
<source>Your keybindings are no longer mapped to Visual Studio commands.</source>
<target state="translated">Visual Studio コマンドとのキー バインドのマップが解除されました。</target>
<note />
</trans-unit>
<trans-unit id="We_noticed_you_suspended_ReSharper_Ultimate_Restore_Visual_Studio_keybindings_to_continue_to_navigate_and_refactor">
<source>We noticed you suspended ‘ReSharper Ultimate’. Restore Visual Studio keybindings to continue to navigate and refactor.</source>
<target state="translated">‘ReSharper Ultimate’ が中断されたものと思われます。Visual Studio キー バインドを復元し、ナビゲートとリファクターを続行してください。</target>
<note />
</trans-unit>
<trans-unit id="Enable_navigation_to_decompiled_sources">
<source>Enable navigation to decompiled sources (experimental)</source>
<target state="translated">逆コンパイルされたソースへのナビゲーションを有効にする (試験段階)</target>
......@@ -1498,6 +1488,11 @@ I agree to all of the foregoing:</source>
<target state="translated">デコンパイラの法的通知</target>
<note />
</trans-unit>
<trans-unit id="Disabling_the_extension_0_unbound_your_keyboard_bindings">
<source>Disabling the extension '{0}' unbound your keyboard bindings.</source>
<target state="new">Disabling the extension '{0}' unbound your keyboard bindings.</target>
<note>0 is an extension name</note>
</trans-unit>
<trans-unit id="Code_style_header_use_editor_config">
<source>The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</source>
<target state="new">The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</target>
......
......@@ -1457,16 +1457,6 @@ Additional information: {1}</source>
<target state="translated">ReSharper/IntelliJ/Vim/etc에 대해 키 바인딩을 사용하세요.</target>
<note />
</trans-unit>
<trans-unit id="Your_keybindings_are_no_longer_mapped_to_Visual_Studio_commands">
<source>Your keybindings are no longer mapped to Visual Studio commands.</source>
<target state="translated">키 바인딩이 더 이상 Visual Studio 명령에 매핑되지 않습니다.</target>
<note />
</trans-unit>
<trans-unit id="We_noticed_you_suspended_ReSharper_Ultimate_Restore_Visual_Studio_keybindings_to_continue_to_navigate_and_refactor">
<source>We noticed you suspended ‘ReSharper Ultimate’. Restore Visual Studio keybindings to continue to navigate and refactor.</source>
<target state="translated">'ReSharper Ultimate'를 일시 중단했습니다. Visual Studio 키 바인딩을 복원하여 계속 탐색하고 리팩터링하세요.</target>
<note />
</trans-unit>
<trans-unit id="Enable_navigation_to_decompiled_sources">
<source>Enable navigation to decompiled sources (experimental)</source>
<target state="translated">디컴파일된 소스에 탐색을 사용하도록 설정(실험적)</target>
......@@ -1498,6 +1488,11 @@ I agree to all of the foregoing:</source>
<target state="translated">디컴파일러 법적 고지 사항</target>
<note />
</trans-unit>
<trans-unit id="Disabling_the_extension_0_unbound_your_keyboard_bindings">
<source>Disabling the extension '{0}' unbound your keyboard bindings.</source>
<target state="new">Disabling the extension '{0}' unbound your keyboard bindings.</target>
<note>0 is an extension name</note>
</trans-unit>
<trans-unit id="Code_style_header_use_editor_config">
<source>The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</source>
<target state="new">The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</target>
......
......@@ -1457,16 +1457,6 @@ Funkcja „Uproszczone ładowanie rozwiązania” jest włączona dla bieżąceg
<target state="translated">Użyj powiązań klawiszy dla programu ReSharper/IntelliJ/Vim/etc.</target>
<note />
</trans-unit>
<trans-unit id="Your_keybindings_are_no_longer_mapped_to_Visual_Studio_commands">
<source>Your keybindings are no longer mapped to Visual Studio commands.</source>
<target state="translated">Twoje powiązania klawiszy nie są już zamapowane na polecenia programu Visual Studio.</target>
<note />
</trans-unit>
<trans-unit id="We_noticed_you_suspended_ReSharper_Ultimate_Restore_Visual_Studio_keybindings_to_continue_to_navigate_and_refactor">
<source>We noticed you suspended ‘ReSharper Ultimate’. Restore Visual Studio keybindings to continue to navigate and refactor.</source>
<target state="translated">Zauważyliśmy, że program „ReSharper Ultimate” został przez Ciebie zawieszony. Przywróć powiązania klawiszy programu Visual Studio, aby kontynuować nawigowanie i refaktoryzację.</target>
<note />
</trans-unit>
<trans-unit id="Enable_navigation_to_decompiled_sources">
<source>Enable navigation to decompiled sources (experimental)</source>
<target state="translated">Włącz nawigowanie do dekompilowanych źródeł (funkcja eksperymentalna)</target>
......@@ -1498,6 +1488,11 @@ Wyrażam zgodę na wszystkie następujące postanowienia:</target>
<target state="translated">Informacje prawne dotyczące Dekompilatora</target>
<note />
</trans-unit>
<trans-unit id="Disabling_the_extension_0_unbound_your_keyboard_bindings">
<source>Disabling the extension '{0}' unbound your keyboard bindings.</source>
<target state="new">Disabling the extension '{0}' unbound your keyboard bindings.</target>
<note>0 is an extension name</note>
</trans-unit>
<trans-unit id="Code_style_header_use_editor_config">
<source>The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</source>
<target state="new">The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</target>
......
......@@ -1457,16 +1457,6 @@ O 'Carregamento da solução leve' está habilitado para a solução atual. Desa
<target state="translated">Use associações de teclas para ReSharper/IntelliJ/Vim/etc.</target>
<note />
</trans-unit>
<trans-unit id="Your_keybindings_are_no_longer_mapped_to_Visual_Studio_commands">
<source>Your keybindings are no longer mapped to Visual Studio commands.</source>
<target state="translated">Suas associações de teclas não são mais mapeadas para comandos do Visual Studio.</target>
<note />
</trans-unit>
<trans-unit id="We_noticed_you_suspended_ReSharper_Ultimate_Restore_Visual_Studio_keybindings_to_continue_to_navigate_and_refactor">
<source>We noticed you suspended ‘ReSharper Ultimate’. Restore Visual Studio keybindings to continue to navigate and refactor.</source>
<target state="translated">Observamos que você suspendeu o 'ReSharper Ultimate'. Restaure as associações de teclas do Visual Studio para continuar a navegar e refatorar.</target>
<note />
</trans-unit>
<trans-unit id="Enable_navigation_to_decompiled_sources">
<source>Enable navigation to decompiled sources (experimental)</source>
<target state="translated">Habilitar a navegação para origens descompiladas (experimental)</target>
......@@ -1498,6 +1488,11 @@ Eu concordo com todo o conteúdo supracitado:</target>
<target state="translated">Aviso Legal do Descompilador</target>
<note />
</trans-unit>
<trans-unit id="Disabling_the_extension_0_unbound_your_keyboard_bindings">
<source>Disabling the extension '{0}' unbound your keyboard bindings.</source>
<target state="new">Disabling the extension '{0}' unbound your keyboard bindings.</target>
<note>0 is an extension name</note>
</trans-unit>
<trans-unit id="Code_style_header_use_editor_config">
<source>The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</source>
<target state="new">The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</target>
......
......@@ -1457,16 +1457,6 @@ Additional information: {1}</source>
<target state="translated">Используйте настраиваемые сочетания клавиш для ReSharper, IntelliJ, Vim и т. д.</target>
<note />
</trans-unit>
<trans-unit id="Your_keybindings_are_no_longer_mapped_to_Visual_Studio_commands">
<source>Your keybindings are no longer mapped to Visual Studio commands.</source>
<target state="translated">Ваши настраиваемые сочетания клавиш больше не сопоставлены с командами Visual Studio.</target>
<note />
</trans-unit>
<trans-unit id="We_noticed_you_suspended_ReSharper_Ultimate_Restore_Visual_Studio_keybindings_to_continue_to_navigate_and_refactor">
<source>We noticed you suspended ‘ReSharper Ultimate’. Restore Visual Studio keybindings to continue to navigate and refactor.</source>
<target state="translated">Мы обратили внимание, что вы перестали использовать "ReSharper Ultimate". Восстановите настраиваемые сочетания клавиш Visual Studio, чтобы возобновить навигацию и рефакторинг.</target>
<note />
</trans-unit>
<trans-unit id="Enable_navigation_to_decompiled_sources">
<source>Enable navigation to decompiled sources (experimental)</source>
<target state="translated">Включить переход к декомпилированным источникам (экспериментальная функция)</target>
......@@ -1498,6 +1488,11 @@ I agree to all of the foregoing:</source>
<target state="translated">Юридическая информация для декомпилятора</target>
<note />
</trans-unit>
<trans-unit id="Disabling_the_extension_0_unbound_your_keyboard_bindings">
<source>Disabling the extension '{0}' unbound your keyboard bindings.</source>
<target state="new">Disabling the extension '{0}' unbound your keyboard bindings.</target>
<note>0 is an extension name</note>
</trans-unit>
<trans-unit id="Code_style_header_use_editor_config">
<source>The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</source>
<target state="new">The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</target>
......
......@@ -1457,16 +1457,6 @@ Geçerli durum için 'basit çözüm yükü' etkin. Hata ayıklama başlatıldı
<target state="translated">ReSharper/IntelliJ/Vim/vb. için anahtar bağlamalarını kullanma</target>
<note />
</trans-unit>
<trans-unit id="Your_keybindings_are_no_longer_mapped_to_Visual_Studio_commands">
<source>Your keybindings are no longer mapped to Visual Studio commands.</source>
<target state="translated">Anahtar bağlamalarınız artık Visual Studio komutlarına eşlenmiş değil.</target>
<note />
</trans-unit>
<trans-unit id="We_noticed_you_suspended_ReSharper_Ultimate_Restore_Visual_Studio_keybindings_to_continue_to_navigate_and_refactor">
<source>We noticed you suspended ‘ReSharper Ultimate’. Restore Visual Studio keybindings to continue to navigate and refactor.</source>
<target state="translated">‘ReSharper Ultimate’ı askıya aldığınızı fark ettik. Gezinmek ve yeniden düzenlemek için Visual Studio anahtar bağlamalarını geri yükleyin.</target>
<note />
</trans-unit>
<trans-unit id="Enable_navigation_to_decompiled_sources">
<source>Enable navigation to decompiled sources (experimental)</source>
<target state="translated">Derlemesi ayrılan kaynaklar için gezintiyi etkinleştirme (deneysel)</target>
......@@ -1498,6 +1488,11 @@ Aşağıdakilerin tümünü onaylıyorum:</target>
<target state="translated">Derleme Ayırıcı Yasal Bildirim</target>
<note />
</trans-unit>
<trans-unit id="Disabling_the_extension_0_unbound_your_keyboard_bindings">
<source>Disabling the extension '{0}' unbound your keyboard bindings.</source>
<target state="new">Disabling the extension '{0}' unbound your keyboard bindings.</target>
<note>0 is an extension name</note>
</trans-unit>
<trans-unit id="Code_style_header_use_editor_config">
<source>The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</source>
<target state="new">The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</target>
......
......@@ -1457,16 +1457,6 @@ Additional information: {1}</source>
<target state="translated">使用 ReSharper/IntelliJ/Vim 等的键绑定。</target>
<note />
</trans-unit>
<trans-unit id="Your_keybindings_are_no_longer_mapped_to_Visual_Studio_commands">
<source>Your keybindings are no longer mapped to Visual Studio commands.</source>
<target state="translated">你的键绑定不再映射到 Visual Studio 命令。</target>
<note />
</trans-unit>
<trans-unit id="We_noticed_you_suspended_ReSharper_Ultimate_Restore_Visual_Studio_keybindings_to_continue_to_navigate_and_refactor">
<source>We noticed you suspended ‘ReSharper Ultimate’. Restore Visual Studio keybindings to continue to navigate and refactor.</source>
<target state="translated">我们注意到你已挂起 "ReSharper Ultimate"。请还原 Visual Studio 键绑定以继续导航和重构。</target>
<note />
</trans-unit>
<trans-unit id="Enable_navigation_to_decompiled_sources">
<source>Enable navigation to decompiled sources (experimental)</source>
<target state="translated">支持导航到反编译源(实验)</target>
......@@ -1498,6 +1488,11 @@ I agree to all of the foregoing:</source>
<target state="translated">Decompiler 法律声明</target>
<note />
</trans-unit>
<trans-unit id="Disabling_the_extension_0_unbound_your_keyboard_bindings">
<source>Disabling the extension '{0}' unbound your keyboard bindings.</source>
<target state="new">Disabling the extension '{0}' unbound your keyboard bindings.</target>
<note>0 is an extension name</note>
</trans-unit>
<trans-unit id="Code_style_header_use_editor_config">
<source>The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</source>
<target state="new">The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</target>
......
......@@ -1457,16 +1457,6 @@ Additional information: {1}</source>
<target state="translated">使用適用於 Resharper/Intellij/Vim/等的按鍵繫結關係</target>
<note />
</trans-unit>
<trans-unit id="Your_keybindings_are_no_longer_mapped_to_Visual_Studio_commands">
<source>Your keybindings are no longer mapped to Visual Studio commands.</source>
<target state="translated">您的按鍵繫結關係已不再對應 Visual Studio 命令。</target>
<note />
</trans-unit>
<trans-unit id="We_noticed_you_suspended_ReSharper_Ultimate_Restore_Visual_Studio_keybindings_to_continue_to_navigate_and_refactor">
<source>We noticed you suspended ‘ReSharper Ultimate’. Restore Visual Studio keybindings to continue to navigate and refactor.</source>
<target state="translated">我們注意到您已暫停 ‘ReSharper Ultimate’。請還原 Visual Studio 按鍵繫結關係以繼續瀏覽及重構。</target>
<note />
</trans-unit>
<trans-unit id="Enable_navigation_to_decompiled_sources">
<source>Enable navigation to decompiled sources (experimental)</source>
<target state="translated">啟用反編譯來源的瀏覽 (實驗性)</target>
......@@ -1498,6 +1488,11 @@ I agree to all of the foregoing:</source>
<target state="translated">解編程式的法律聲明</target>
<note />
</trans-unit>
<trans-unit id="Disabling_the_extension_0_unbound_your_keyboard_bindings">
<source>Disabling the extension '{0}' unbound your keyboard bindings.</source>
<target state="new">Disabling the extension '{0}' unbound your keyboard bindings.</target>
<note>0 is an extension name</note>
</trans-unit>
<trans-unit id="Code_style_header_use_editor_config">
<source>The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</source>
<target state="new">The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files.</target>
......
......@@ -40,7 +40,7 @@ public void TestRemoteHostConnect()
using (var remoteHostService = CreateService())
{
var input = "Test";
var output = remoteHostService.Connect(input, serializedSession: null, cancellationToken: CancellationToken.None);
var output = remoteHostService.Connect(input, uiCultureLCID: 0, cultureLCID: 0, serializedSession: null, cancellationToken: CancellationToken.None);
Assert.Equal(input, output);
}
......
......@@ -1100,6 +1100,7 @@ public static bool IsParameterTypeContext(this SyntaxTree syntaxTree, int positi
if (token.IsKind(SyntaxKind.RefKeyword) ||
token.IsKind(SyntaxKind.OutKeyword) ||
token.IsKind(SyntaxKind.InKeyword) ||
token.IsKind(SyntaxKind.ParamsKeyword) ||
token.IsKind(SyntaxKind.ThisKeyword))
{
......@@ -1182,6 +1183,7 @@ public static bool IsParameterTypeContext(this SyntaxTree syntaxTree, int positi
token = token.GetPreviousTokenIfTouchingWord(position);
if (token.IsKind(SyntaxKind.RefKeyword) ||
token.IsKind(SyntaxKind.InKeyword) ||
token.IsKind(SyntaxKind.OutKeyword))
{
position = token.SpanStart;
......@@ -2175,8 +2177,10 @@ public static bool IsLabelContext(this SyntaxTree syntaxTree, int position, Canc
}
// Goo(ref |
// Goo(bar |
// Goo(in |
// Goo(out |
if (token.IsKind(SyntaxKind.RefKeyword) ||
token.IsKind(SyntaxKind.InKeyword) ||
token.IsKind(SyntaxKind.OutKeyword))
{
if (token.Parent.IsKind(SyntaxKind.Argument))
......
......@@ -8,7 +8,7 @@ namespace Microsoft.CodeAnalysis.Remote
{
internal interface IRemoteHostService
{
string Connect(string host, string serializedSession, CancellationToken cancellationToken);
string Connect(string host, int uiCultureLCID, int cultureLCID, string serializedSession, CancellationToken cancellationToken);
Task SynchronizePrimaryWorkspaceAsync(Checksum checksum, CancellationToken cancellationToken);
Task SynchronizeGlobalAssetsAsync(Checksum[] checksums, CancellationToken cancellationToken);
......
......@@ -4,6 +4,7 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Runtime.InteropServices;
using System.Threading;
......@@ -52,7 +53,7 @@ static RemoteHostService()
Rpc.StartListening();
}
public string Connect(string host, string serializedSession, CancellationToken cancellationToken)
public string Connect(string host, int uiCultureLCID, int cultureLCID, string serializedSession, CancellationToken cancellationToken)
{
return RunService(token =>
{
......@@ -62,7 +63,7 @@ public string Connect(string host, string serializedSession, CancellationToken c
var existing = Interlocked.CompareExchange(ref _host, host, null);
SetGlobalContext(serializedSession);
SetGlobalContext(uiCultureLCID, cultureLCID, serializedSession);
if (existing != null && existing != host)
{
......@@ -204,7 +205,7 @@ private void SetSessionInfo(Dictionary<string, object> m)
m["InstanceId"] = _primaryInstance;
}
private static void SetGlobalContext(string serializedSession)
private static void SetGlobalContext(int uiCultureLCID, int cultureLCID, string serializedSession)
{
// set global telemetry session
var session = GetTelemetrySession(serializedSession);
......@@ -213,6 +214,8 @@ private static void SetGlobalContext(string serializedSession)
return;
}
EnsureCulture(uiCultureLCID, cultureLCID);
// set roslyn loggers
WatsonReporter.SetTelemetrySession(session);
......@@ -223,6 +226,31 @@ private static void SetGlobalContext(string serializedSession)
FatalError.NonFatalHandler = WatsonReporter.Report;
}
private static void EnsureCulture(int uiCultureLCID, int cultureLCID)
{
// this follows what VS does
// http://index/?leftProject=Microsoft.VisualStudio.Platform.AppDomainManager&leftSymbol=wok83tw8yxy7&file=VsAppDomainManager.cs&line=106
try
{
// set default culture for Roslyn OOP
CultureInfo.DefaultThreadCurrentUICulture = new CultureInfo(uiCultureLCID);
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo(cultureLCID);
}
catch (Exception ex) when (ExpectedCultureIssue(ex))
{
// ignore expected culture issue
}
}
private static bool ExpectedCultureIssue(Exception ex)
{
// report exception
WatsonReporter.Report(ex);
// ignore expected exception
return ex is ArgumentOutOfRangeException || ex is CultureNotFoundException;
}
private static TelemetrySession GetTelemetrySession(string serializedSession)
{
var session = serializedSession != null ? new TelemetrySession(serializedSession) : null;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册