Created unit test for Windows-only resolver bug.
Added an unit test for a resolver bug that happens only on Windows (see https://github.com/icsharpcode/NRefactory/issues/359).
Note that the resolver decides that precedent is of type Task, not Task<int> but only on Windows. On Ubuntu, it correctly guesses the type of the precedent task.
For extra weirdness, comment the Console.WriteLine (precedent.IsFaulted); line. Note that the bug will go away.
Disclaimer: I'm not 100% sure my Windows and Linux systems are running the same IKVM/Cecil versions.
I assume on Windows, you load the MS.NET reference assemblies? I'm thinking some methods might have additional overloads there that don't exist on Mono.
I'm using .NET on Windows and Mono on Ubuntu. I haven't installed Mono on Windows. I'm using plain standard NRefactory as far as I'm aware.
Visual Studio correctly resolves precedent to Task<int>, just like NRefactory on Linux. So even with any potential additional overloads the Linux solution is still the correct one.
Also, I find it highly suspicious that removing the IsFaulted line can change the chosen overload.
Either way, this is what I get (Windows results obtained with VS debugger, Linux results with MD).
Test program:
[Test]
public void LambdaTaskParameterTest()
{
string program = @"using System.Threading.Tasks;
class TestClass {
public void TestMethod () {
Task<int> foo = null;
$foo.ContinueWith$(precedent => {
//Console.WriteLine (precedent.IsFaulted);
});
}
}";
var resolveResult = Resolve<MethodGroupResolveResult>(program);
} //Insert breakpoint here
On Windows NRefactory, the MethodGroupResolveResult of ContinueWith gives me 40 methods (0 extension methods, 2 method lists with 20 methods each).
- methodLists Count = 2 System.Collections.Generic.IList<ICSharpCode.NRefactory.CSharp.Resolver.MethodListWithDeclaringType> {System.Collections.Generic.List<ICSharpCode.NRefactory.CSharp.Resolver.MethodListWithDeclaringType>}
- [0] Count = 20 ICSharpCode.NRefactory.CSharp.Resolver.MethodListWithDeclaringType
+ [0] {[Method System.Threading.Tasks.Task.ContinueWith(continuationAction:System.Action`1[[System.Threading.Tasks.Task]]):System.Threading.Tasks.Task]} ICSharpCode.NRefactory.TypeSystem.IParameterizedMember {ICSharpCode.NRefactory.TypeSystem.Implementation.DefaultResolvedMethod}
+ [1] {[Method System.Threading.Tasks.Task.ContinueWith(continuationAction:System.Action`1[[System.Threading.Tasks.Task]], cancellationToken:System.Threading.CancellationToken):System.Threading.Tasks.Task]} ICSharpCode.NRefactory.TypeSystem.IParameterizedMember {ICSharpCode.NRefactory.TypeSystem.Implementation.DefaultResolvedMethod}
+ [2] {[Method System.Threading.Tasks.Task.ContinueWith(continuationAction:System.Action`1[[System.Threading.Tasks.Task]], scheduler:System.Threading.Tasks.TaskScheduler):System.Threading.Tasks.Task]} ICSharpCode.NRefactory.TypeSystem.IParameterizedMember {ICSharpCode.NRefactory.TypeSystem.Implementation.DefaultResolvedMethod}
+ [3] {[Method System.Threading.Tasks.Task.ContinueWith(continuationAction:System.Action`1[[System.Threading.Tasks.Task]], continuationOptions:System.Threading.Tasks.TaskContinuationOptions):System.Threading.Tasks.Task]} ICSharpCode.NRefactory.TypeSystem.IParameterizedMember {ICSharpCode.NRefactory.TypeSystem.Implementation.DefaultResolvedMethod}
+ [4] {[Method System.Threading.Tasks.Task.ContinueWith(continuationAction:System.Action`1[[System.Threading.Tasks.Task]], cancellationToken:System.Threading.CancellationToken, continuationOptions:System.Threading.Tasks.TaskContinuationOptions, scheduler:System.Threading.Tasks.TaskScheduler):System.Threading.Tasks.Task]} ICSharpCode.NRefactory.TypeSystem.IParameterizedMember {ICSharpCode.NRefactory.TypeSystem.Implementation.DefaultResolvedMethod}
+ [5] {[Method System.Threading.Tasks.Task.ContinueWith(continuationAction:System.Action`2[[System.Threading.Tasks.Task],[System.Object]], state:System.Object):System.Threading.Tasks.Task]} ICSharpCode.NRefactory.TypeSystem.IParameterizedMember {ICSharpCode.NRefactory.TypeSystem.Implementation.DefaultResolvedMethod}
+ [6] {[Method System.Threading.Tasks.Task.ContinueWith(continuationAction:System.Action`2[[System.Threading.Tasks.Task],[System.Object]], state:System.Object, cancellationToken:System.Threading.CancellationToken):System.Threading.Tasks.Task]} ICSharpCode.NRefactory.TypeSystem.IParameterizedMember {ICSharpCode.NRefactory.TypeSystem.Implementation.DefaultResolvedMethod}
+ [7] {[Method System.Threading.Tasks.Task.ContinueWith(continuationAction:System.Action`2[[System.Threading.Tasks.Task],[System.Object]], state:System.Object, scheduler:System.Threading.Tasks.TaskScheduler):System.Threading.Tasks.Task]} ICSharpCode.NRefactory.TypeSystem.IParameterizedMember {ICSharpCode.NRefactory.TypeSystem.Implementation.DefaultResolvedMethod}
+ [8] {[Method System.Threading.Tasks.Task.ContinueWith(continuationAction:System.Action`2[[System.Threading.Tasks.Task],[System.Object]], state:System.Object, continuationOptions:System.Threading.Tasks.TaskContinuationOptions):System.Threading.Tasks.Task]} ICSharpCode.NRefactory.TypeSystem.IParameterizedMember {ICSharpCode.NRefactory.TypeSystem.Implementation.DefaultResolvedMethod}
+ [9] {[Method System.Threading.Tasks.Task.ContinueWith(continuationAction:System.Action`2[[System.Threading.Tasks.Task],[System.Object]], state:System.Object, cancellationToken:System.Threading.CancellationToken, continuationOptions:System.Threading.Tasks.TaskContinuationOptions, scheduler:System.Threading.Tasks.TaskScheduler):System.Threading.Tasks.Task]} ICSharpCode.NRefactory.TypeSystem.IParameterizedMember {ICSharpCode.NRefactory.TypeSystem.Implementation.DefaultResolvedMethod}
+ [10] {[Method System.Threading.Tasks.Task.ContinueWith``1(continuationFunction:System.Func`2[[System.Threading.Tasks.Task],[``0]]):System.Threading.Tasks.Task`1[[``0]]]} ICSharpCode.NRefactory.TypeSystem.IParameterizedMember {ICSharpCode.NRefactory.TypeSystem.Implementation.DefaultResolvedMethod}
+ [11] {[Method System.Threading.Tasks.Task.ContinueWith``1(continuationFunction:System.Func`2[[System.Threading.Tasks.Task],[``0]], cancellationToken:System.Threading.CancellationToken):System.Threading.Tasks.Task`1[[``0]]]} ICSharpCode.NRefactory.TypeSystem.IParameterizedMember {ICSharpCode.NRefactory.TypeSystem.Implementation.DefaultResolvedMethod}
+ [12] {[Method System.Threading.Tasks.Task.ContinueWith``1(continuationFunction:System.Func`2[[System.Threading.Tasks.Task],[``0]], scheduler:System.Threading.Tasks.TaskScheduler):System.Threading.Tasks.Task`1[[``0]]]} ICSharpCode.NRefactory.TypeSystem.IParameterizedMember {ICSharpCode.NRefactory.TypeSystem.Implementation.DefaultResolvedMethod}
+ [13] {[Method System.Threading.Tasks.Task.ContinueWith``1(continuationFunction:System.Func`2[[System.Threading.Tasks.Task],[``0]], continuationOptions:System.Threading.Tasks.TaskContinuationOptions):System.Threading.Tasks.Task`1[[``0]]]} ICSharpCode.NRefactory.TypeSystem.IParameterizedMember {ICSharpCode.NRefactory.TypeSystem.Implementation.DefaultResolvedMethod}
+ [14] {[Method System.Threading.Tasks.Task.ContinueWith``1(continuationFunction:System.Func`2[[System.Threading.Tasks.Task],[``0]], cancellationToken:System.Threading.CancellationToken, continuationOptions:System.Threading.Tasks.TaskContinuationOptions, scheduler:System.Threading.Tasks.TaskScheduler):System.Threading.Tasks.Task`1[[``0]]]} ICSharpCode.NRefactory.TypeSystem.IParameterizedMember {ICSharpCode.NRefactory.TypeSystem.Implementation.DefaultResolvedMethod}
+ [15] {[Method System.Threading.Tasks.Task.ContinueWith``1(continuationFunction:System.Func`3[[System.Threading.Tasks.Task],[System.Object],[``0]], state:System.Object):System.Threading.Tasks.Task`1[[``0]]]} ICSharpCode.NRefactory.TypeSystem.IParameterizedMember {ICSharpCode.NRefactory.TypeSystem.Implementation.DefaultResolvedMethod}
+ [16] {[Method System.Threading.Tasks.Task.ContinueWith``1(continuationFunction:System.Func`3[[System.Threading.Tasks.Task],[System.Object],[``0]], state:System.Object, cancellationToken:System.Threading.CancellationToken):System.Threading.Tasks.Task`1[[``0]]]} ICSharpCode.NRefactory.TypeSystem.IParameterizedMember {ICSharpCode.NRefactory.TypeSystem.Implementation.DefaultResolvedMethod}
+ [17] {[Method System.Threading.Tasks.Task.ContinueWith``1(continuationFunction:System.Func`3[[System.Threading.Tasks.Task],[System.Object],[``0]], state:System.Object, scheduler:System.Threading.Tasks.TaskScheduler):System.Threading.Tasks.Task`1[[``0]]]} ICSharpCode.NRefactory.TypeSystem.IParameterizedMember {ICSharpCode.NRefactory.TypeSystem.Implementation.DefaultResolvedMethod}
+ [18] {[Method System.Threading.Tasks.Task.ContinueWith``1(continuationFunction:System.Func`3[[System.Threading.Tasks.Task],[System.Object],[``0]], state:System.Object, continuationOptions:System.Threading.Tasks.TaskContinuationOptions):System.Threading.Tasks.Task`1[[``0]]]} ICSharpCode.NRefactory.TypeSystem.IParameterizedMember {ICSharpCode.NRefactory.TypeSystem.Implementation.DefaultResolvedMethod}
+ [19] {[Method System.Threading.Tasks.Task.ContinueWith``1(continuationFunction:System.Func`3[[System.Threading.Tasks.Task],[System.Object],[``0]], state:System.Object, cancellationToken:System.Threading.CancellationToken, continuationOptions:System.Threading.Tasks.TaskContinuationOptions, scheduler:System.Threading.Tasks.TaskScheduler):System.Threading.Tasks.Task`1[[``0]]]} ICSharpCode.NRefactory.TypeSystem.IParameterizedMember {ICSharpCode.NRefactory.TypeSystem.Implementation.DefaultResolvedMethod}
- [1] Count = 20 ICSharpCode.NRefactory.CSharp.Resolver.MethodListWithDeclaringType
+ [0] {[SpecializedMethod System.Threading.Tasks.Task`1[[System.Int32]].ContinueWith(continuationAction:System.Action`1[[System.Threading.Tasks.Task`1[[System.Int32]]]]):System.Threading.Tasks.Task]} ICSharpCode.NRefactory.TypeSystem.IParameterizedMember {ICSharpCode.NRefactory.TypeSystem.Implementation.SpecializedMethod}
+ [1] {[SpecializedMethod System.Threading.Tasks.Task`1[[System.Int32]].ContinueWith(continuationAction:System.Action`1[[System.Threading.Tasks.Task`1[[System.Int32]]]], cancellationToken:System.Threading.CancellationToken):System.Threading.Tasks.Task]} ICSharpCode.NRefactory.TypeSystem.IParameterizedMember {ICSharpCode.NRefactory.TypeSystem.Implementation.SpecializedMethod}
+ [2] {[SpecializedMethod System.Threading.Tasks.Task`1[[System.Int32]].ContinueWith(continuationAction:System.Action`1[[System.Threading.Tasks.Task`1[[System.Int32]]]], scheduler:System.Threading.Tasks.TaskScheduler):System.Threading.Tasks.Task]} ICSharpCode.NRefactory.TypeSystem.IParameterizedMember {ICSharpCode.NRefactory.TypeSystem.Implementation.SpecializedMethod}
+ [3] {[SpecializedMethod System.Threading.Tasks.Task`1[[System.Int32]].ContinueWith(continuationAction:System.Action`1[[System.Threading.Tasks.Task`1[[System.Int32]]]], continuationOptions:System.Threading.Tasks.TaskContinuationOptions):System.Threading.Tasks.Task]} ICSharpCode.NRefactory.TypeSystem.IParameterizedMember {ICSharpCode.NRefactory.TypeSystem.Implementation.SpecializedMethod}
+ [4] {[SpecializedMethod System.Threading.Tasks.Task`1[[System.Int32]].ContinueWith(continuationAction:System.Action`1[[System.Threading.Tasks.Task`1[[System.Int32]]]], cancellationToken:System.Threading.CancellationToken, continuationOptions:System.Threading.Tasks.TaskContinuationOptions, scheduler:System.Threading.Tasks.TaskScheduler):System.Threading.Tasks.Task]} ICSharpCode.NRefactory.TypeSystem.IParameterizedMember {ICSharpCode.NRefactory.TypeSystem.Implementation.SpecializedMethod}
+ [5] {[SpecializedMethod System.Threading.Tasks.Task`1[[System.Int32]].ContinueWith(continuationAction:System.Action`2[[System.Threading.Tasks.Task`1[[System.Int32]]],[System.Object]], state:System.Object):System.Threading.Tasks.Task]} ICSharpCode.NRefactory.TypeSystem.IParameterizedMember {ICSharpCode.NRefactory.TypeSystem.Implementation.SpecializedMethod}
+ [6] {[SpecializedMethod System.Threading.Tasks.Task`1[[System.Int32]].ContinueWith(continuationAction:System.Action`2[[System.Threading.Tasks.Task`1[[System.Int32]]],[System.Object]], state:System.Object, cancellationToken:System.Threading.CancellationToken):System.Threading.Tasks.Task]} ICSharpCode.NRefactory.TypeSystem.IParameterizedMember {ICSharpCode.NRefactory.TypeSystem.Implementation.SpecializedMethod}
+ [7] {[SpecializedMethod System.Threading.Tasks.Task`1[[System.Int32]].ContinueWith(continuationAction:System.Action`2[[System.Threading.Tasks.Task`1[[System.Int32]]],[System.Object]], state:System.Object, scheduler:System.Threading.Tasks.TaskScheduler):System.Threading.Tasks.Task]} ICSharpCode.NRefactory.TypeSystem.IParameterizedMember {ICSharpCode.NRefactory.TypeSystem.Implementation.SpecializedMethod}
+ [8] {[SpecializedMethod System.Threading.Tasks.Task`1[[System.Int32]].ContinueWith(continuationAction:System.Action`2[[System.Threading.Tasks.Task`1[[System.Int32]]],[System.Object]], state:System.Object, continuationOptions:System.Threading.Tasks.TaskContinuationOptions):System.Threading.Tasks.Task]} ICSharpCode.NRefactory.TypeSystem.IParameterizedMember {ICSharpCode.NRefactory.TypeSystem.Implementation.SpecializedMethod}
+ [9] {[SpecializedMethod System.Threading.Tasks.Task`1[[System.Int32]].ContinueWith(continuationAction:System.Action`2[[System.Threading.Tasks.Task`1[[System.Int32]]],[System.Object]], state:System.Object, cancellationToken:System.Threading.CancellationToken, continuationOptions:System.Threading.Tasks.TaskContinuationOptions, scheduler:System.Threading.Tasks.TaskScheduler):System.Threading.Tasks.Task]} ICSharpCode.NRefactory.TypeSystem.IParameterizedMember {ICSharpCode.NRefactory.TypeSystem.Implementation.SpecializedMethod}
+ [10] {[SpecializedMethod System.Threading.Tasks.Task`1[[System.Int32]].ContinueWith[``0](continuationFunction:System.Func`2[[System.Threading.Tasks.Task`1[[System.Int32]]],[``0]]):System.Threading.Tasks.Task`1[[``0]]]} ICSharpCode.NRefactory.TypeSystem.IParameterizedMember {ICSharpCode.NRefactory.TypeSystem.Implementation.SpecializedMethod}
+ [11] {[SpecializedMethod System.Threading.Tasks.Task`1[[System.Int32]].ContinueWith[``0](continuationFunction:System.Func`2[[System.Threading.Tasks.Task`1[[System.Int32]]],[``0]], cancellationToken:System.Threading.CancellationToken):System.Threading.Tasks.Task`1[[``0]]]} ICSharpCode.NRefactory.TypeSystem.IParameterizedMember {ICSharpCode.NRefactory.TypeSystem.Implementation.SpecializedMethod}
+ [12] {[SpecializedMethod System.Threading.Tasks.Task`1[[System.Int32]].ContinueWith[``0](continuationFunction:System.Func`2[[System.Threading.Tasks.Task`1[[System.Int32]]],[``0]], scheduler:System.Threading.Tasks.TaskScheduler):System.Threading.Tasks.Task`1[[``0]]]} ICSharpCode.NRefactory.TypeSystem.IParameterizedMember {ICSharpCode.NRefactory.TypeSystem.Implementation.SpecializedMethod}
+ [13] {[SpecializedMethod System.Threading.Tasks.Task`1[[System.Int32]].ContinueWith[``0](continuationFunction:System.Func`2[[System.Threading.Tasks.Task`1[[System.Int32]]],[``0]], continuationOptions:System.Threading.Tasks.TaskContinuationOptions):System.Threading.Tasks.Task`1[[``0]]]} ICSharpCode.NRefactory.TypeSystem.IParameterizedMember {ICSharpCode.NRefactory.TypeSystem.Implementation.SpecializedMethod}
+ [14] {[SpecializedMethod System.Threading.Tasks.Task`1[[System.Int32]].ContinueWith[``0](continuationFunction:System.Func`2[[System.Threading.Tasks.Task`1[[System.Int32]]],[``0]], cancellationToken:System.Threading.CancellationToken, continuationOptions:System.Threading.Tasks.TaskContinuationOptions, scheduler:System.Threading.Tasks.TaskScheduler):System.Threading.Tasks.Task`1[[``0]]]} ICSharpCode.NRefactory.TypeSystem.IParameterizedMember {ICSharpCode.NRefactory.TypeSystem.Implementation.SpecializedMethod}
+ [15] {[SpecializedMethod System.Threading.Tasks.Task`1[[System.Int32]].ContinueWith[``0](continuationFunction:System.Func`3[[System.Threading.Tasks.Task`1[[System.Int32]]],[System.Object],[``0]], state:System.Object):System.Threading.Tasks.Task`1[[``0]]]} ICSharpCode.NRefactory.TypeSystem.IParameterizedMember {ICSharpCode.NRefactory.TypeSystem.Implementation.SpecializedMethod}
+ [16] {[SpecializedMethod System.Threading.Tasks.Task`1[[System.Int32]].ContinueWith[``0](continuationFunction:System.Func`3[[System.Threading.Tasks.Task`1[[System.Int32]]],[System.Object],[``0]], state:System.Object, cancellationToken:System.Threading.CancellationToken):System.Threading.Tasks.Task`1[[``0]]]} ICSharpCode.NRefactory.TypeSystem.IParameterizedMember {ICSharpCode.NRefactory.TypeSystem.Implementation.SpecializedMethod}
+ [17] {[SpecializedMethod System.Threading.Tasks.Task`1[[System.Int32]].ContinueWith[``0](continuationFunction:System.Func`3[[System.Threading.Tasks.Task`1[[System.Int32]]],[System.Object],[``0]], state:System.Object, scheduler:System.Threading.Tasks.TaskScheduler):System.Threading.Tasks.Task`1[[``0]]]} ICSharpCode.NRefactory.TypeSystem.IParameterizedMember {ICSharpCode.NRefactory.TypeSystem.Implementation.SpecializedMethod}
+ [18] {[SpecializedMethod System.Threading.Tasks.Task`1[[System.Int32]].ContinueWith[``0](continuationFunction:System.Func`3[[System.Threading.Tasks.Task`1[[System.Int32]]],[System.Object],[``0]], state:System.Object, continuationOptions:System.Threading.Tasks.TaskContinuationOptions):System.Threading.Tasks.Task`1[[``0]]]} ICSharpCode.NRefactory.TypeSystem.IParameterizedMember {ICSharpCode.NRefactory.TypeSystem.Implementation.SpecializedMethod}
+ [19] {[SpecializedMethod System.Threading.Tasks.Task`1[[System.Int32]].ContinueWith[``0](continuationFunction:System.Func`3[[System.Threading.Tasks.Task`1[[System.Int32]]],[System.Object],[``0]], state:System.Object, cancellationToken:System.Threading.CancellationToken, continuationOptions:System.Threading.Tasks.TaskContinuationOptions, scheduler:System.Threading.Tasks.TaskScheduler):System.Threading.Tasks.Task`1[[``0]]]} ICSharpCode.NRefactory.TypeSystem.IParameterizedMember {ICSharpCode.NRefactory.TypeSystem.Implementation.SpecializedMethod}
NRefactory on Linux also gives me 40 methods, in 2 method lists:
[0] {[Method System.Threading.Tasks.Task.ContinueWith(continuationAction:System.Action`1[[System.Threading.Tasks.Task]]):System.Threading.Tasks.Task]} ICSharpCode.NRefactory.TypeSystem.Implementation.DefaultResolvedMethod
[1] {[Method System.Threading.Tasks.Task.ContinueWith(continuationAction:System.Action`1[[System.Threading.Tasks.Task]], continuationOptions:System.Threading.Tasks.TaskContinuationOptions):System.Threading.Tasks.Task]} ICSharpCode.NRefactory.TypeSystem.Implementation.DefaultResolvedMethod
[2] {[Method System.Threading.Tasks.Task.ContinueWith(continuationAction:System.Action`1[[System.Threading.Tasks.Task]], cancellationToken:System.Threading.CancellationToken):System.Threading.Tasks.Task]} ICSharpCode.NRefactory.TypeSystem.Implementation.DefaultResolvedMethod
[3] {[Method System.Threading.Tasks.Task.ContinueWith(continuationAction:System.Action`1[[System.Threading.Tasks.Task]], scheduler:System.Threading.Tasks.TaskScheduler):System.Threading.Tasks.Task]} ICSharpCode.NRefactory.TypeSystem.Implementation.DefaultResolvedMethod
[4] {[Method System.Threading.Tasks.Task.ContinueWith(continuationAction:System.Action`1[[System.Threading.Tasks.Task]], cancellationToken:System.Threading.CancellationToken, continuationOptions:System.Threading.Tasks.TaskContinuationOptions, scheduler:System.Threading.Tasks.TaskScheduler):System.Threading.Tasks.Task]} ICSharpCode.NRefactory.TypeSystem.Implementation.DefaultResolvedMethod
[5] {[Method System.Threading.Tasks.Task.ContinueWith``1(continuationFunction:System.Func`2[[System.Threading.Tasks.Task],[``0]]):System.Threading.Tasks.Task`1[[``0]]]} ICSharpCode.NRefactory.TypeSystem.Implementation.DefaultResolvedMethod
[6] {[Method System.Threading.Tasks.Task.ContinueWith``1(continuationFunction:System.Func`2[[System.Threading.Tasks.Task],[``0]], continuationOptions:System.Threading.Tasks.TaskContinuationOptions):System.Threading.Tasks.Task`1[[``0]]]} ICSharpCode.NRefactory.TypeSystem.Implementation.DefaultResolvedMethod
[7] {[Method System.Threading.Tasks.Task.ContinueWith``1(continuationFunction:System.Func`2[[System.Threading.Tasks.Task],[``0]], cancellationToken:System.Threading.CancellationToken):System.Threading.Tasks.Task`1[[``0]]]} ICSharpCode.NRefactory.TypeSystem.Implementation.DefaultResolvedMethod
[8] {[Method System.Threading.Tasks.Task.ContinueWith``1(continuationFunction:System.Func`2[[System.Threading.Tasks.Task],[``0]], scheduler:System.Threading.Tasks.TaskScheduler):System.Threading.Tasks.Task`1[[``0]]]} ICSharpCode.NRefactory.TypeSystem.Implementation.DefaultResolvedMethod
[9] {[Method System.Threading.Tasks.Task.ContinueWith``1(continuationFunction:System.Func`2[[System.Threading.Tasks.Task],[``0]], cancellationToken:System.Threading.CancellationToken, continuationOptions:System.Threading.Tasks.TaskContinuationOptions, scheduler:System.Threading.Tasks.TaskScheduler):System.Threading.Tasks.Task`1[[``0]]]} ICSharpCode.NRefactory.TypeSystem.Implementation.DefaultResolvedMethod
[10] {[Method System.Threading.Tasks.Task.ContinueWith(continuationAction:System.Action`2[[System.Threading.Tasks.Task],[System.Object]], state:System.Object, cancellationToken:System.Threading.CancellationToken, continuationOptions:System.Threading.Tasks.TaskContinuationOptions, scheduler:System.Threading.Tasks.TaskScheduler):System.Threading.Tasks.Task]} ICSharpCode.NRefactory.TypeSystem.Implementation.DefaultResolvedMethod
[11] {[Method System.Threading.Tasks.Task.ContinueWith(continuationAction:System.Action`2[[System.Threading.Tasks.Task],[System.Object]], state:System.Object):System.Threading.Tasks.Task]} ICSharpCode.NRefactory.TypeSystem.Implementation.DefaultResolvedMethod
[12] {[Method System.Threading.Tasks.Task.ContinueWith(continuationAction:System.Action`2[[System.Threading.Tasks.Task],[System.Object]], state:System.Object, cancellationToken:System.Threading.CancellationToken):System.Threading.Tasks.Task]} ICSharpCode.NRefactory.TypeSystem.Implementation.DefaultResolvedMethod
[13] {[Method System.Threading.Tasks.Task.ContinueWith(continuationAction:System.Action`2[[System.Threading.Tasks.Task],[System.Object]], state:System.Object, continuationOptions:System.Threading.Tasks.TaskContinuationOptions):System.Threading.Tasks.Task]} ICSharpCode.NRefactory.TypeSystem.Implementation.DefaultResolvedMethod
[14] {[Method System.Threading.Tasks.Task.ContinueWith(continuationAction:System.Action`2[[System.Threading.Tasks.Task],[System.Object]], state:System.Object, scheduler:System.Threading.Tasks.TaskScheduler):System.Threading.Tasks.Task]} ICSharpCode.NRefactory.TypeSystem.Implementation.DefaultResolvedMethod
[15] {[Method System.Threading.Tasks.Task.ContinueWith``1(continuationFunction:System.Func`3[[System.Threading.Tasks.Task],[System.Object],[``0]], state:System.Object):System.Threading.Tasks.Task`1[[``0]]]} ICSharpCode.NRefactory.TypeSystem.Implementation.DefaultResolvedMethod
[16] {[Method System.Threading.Tasks.Task.ContinueWith``1(continuationFunction:System.Func`3[[System.Threading.Tasks.Task],[System.Object],[``0]], state:System.Object, continuationOptions:System.Threading.Tasks.TaskContinuationOptions):System.Threading.Tasks.Task`1[[``0]]]} ICSharpCode.NRefactory.TypeSystem.Implementation.DefaultResolvedMethod
[17] {[Method System.Threading.Tasks.Task.ContinueWith``1(continuationFunction:System.Func`3[[System.Threading.Tasks.Task],[System.Object],[``0]], state:System.Object, cancellationToken:System.Threading.CancellationToken):System.Threading.Tasks.Task`1[[``0]]]} ICSharpCode.NRefactory.TypeSystem.Implementation.DefaultResolvedMethod
[18] {[Method System.Threading.Tasks.Task.ContinueWith``1(continuationFunction:System.Func`3[[System.Threading.Tasks.Task],[System.Object],[``0]], state:System.Object, scheduler:System.Threading.Tasks.TaskScheduler):System.Threading.Tasks.Task`1[[``0]]]} ICSharpCode.NRefactory.TypeSystem.Implementation.DefaultResolvedMethod
[19] {[Method System.Threading.Tasks.Task.ContinueWith``1(continuationFunction:System.Func`3[[System.Threading.Tasks.Task],[System.Object],[``0]], state:System.Object, cancellationToken:System.Threading.CancellationToken, continuationOptions:System.Threading.Tasks.TaskContinuationOptions, scheduler:System.Threading.Tasks.TaskScheduler):System.Threading.Tasks.Task`1[[``0]]]} ICSharpCode.NRefactory.TypeSystem.Implementation.DefaultResolvedMethod
Method list 2:
[0] {[SpecializedMethod System.Threading.Tasks.Task`1[[System.Int32]].ContinueWith(continuationAction:System.Action`1[[System.Threading.Tasks.Task`1[[System.Int32]]]]):System.Threading.Tasks.Task]} ICSharpCode.NRefactory.TypeSystem.Implementation.SpecializedMethod
[1] {[SpecializedMethod System.Threading.Tasks.Task`1[[System.Int32]].ContinueWith(continuationAction:System.Action`1[[System.Threading.Tasks.Task`1[[System.Int32]]]], continuationOptions:System.Threading.Tasks.TaskContinuationOptions):System.Threading.Tasks.Task]} ICSharpCode.NRefactory.TypeSystem.Implementation.SpecializedMethod
[2] {[SpecializedMethod System.Threading.Tasks.Task`1[[System.Int32]].ContinueWith(continuationAction:System.Action`1[[System.Threading.Tasks.Task`1[[System.Int32]]]], cancellationToken:System.Threading.CancellationToken):System.Threading.Tasks.Task]} ICSharpCode.NRefactory.TypeSystem.Implementation.SpecializedMethod
[3] {[SpecializedMethod System.Threading.Tasks.Task`1[[System.Int32]].ContinueWith(continuationAction:System.Action`1[[System.Threading.Tasks.Task`1[[System.Int32]]]], scheduler:System.Threading.Tasks.TaskScheduler):System.Threading.Tasks.Task]} ICSharpCode.NRefactory.TypeSystem.Implementation.SpecializedMethod
[4] {[SpecializedMethod System.Threading.Tasks.Task`1[[System.Int32]].ContinueWith(continuationAction:System.Action`1[[System.Threading.Tasks.Task`1[[System.Int32]]]], cancellationToken:System.Threading.CancellationToken, continuationOptions:System.Threading.Tasks.TaskContinuationOptions, scheduler:System.Threading.Tasks.TaskScheduler):System.Threading.Tasks.Task]} ICSharpCode.NRefactory.TypeSystem.Implementation.SpecializedMethod
[5] {[SpecializedMethod System.Threading.Tasks.Task`1[[System.Int32]].ContinueWith[``0](continuationFunction:System.Func`2[[System.Threading.Tasks.Task`1[[System.Int32]]],[``0]]):System.Threading.Tasks.Task`1[[``0]]]} ICSharpCode.NRefactory.TypeSystem.Implementation.SpecializedMethod
[6] {[SpecializedMethod System.Threading.Tasks.Task`1[[System.Int32]].ContinueWith[``0](continuationFunction:System.Func`2[[System.Threading.Tasks.Task`1[[System.Int32]]],[``0]], cancellationToken:System.Threading.CancellationToken):System.Threading.Tasks.Task`1[[``0]]]} ICSharpCode.NRefactory.TypeSystem.Implementation.SpecializedMethod
[7] {[SpecializedMethod System.Threading.Tasks.Task`1[[System.Int32]].ContinueWith[``0](continuationFunction:System.Func`2[[System.Threading.Tasks.Task`1[[System.Int32]]],[``0]], continuationOptions:System.Threading.Tasks.TaskContinuationOptions):System.Threading.Tasks.Task`1[[``0]]]} ICSharpCode.NRefactory.TypeSystem.Implementation.SpecializedMethod
[8] {[SpecializedMethod System.Threading.Tasks.Task`1[[System.Int32]].ContinueWith[``0](continuationFunction:System.Func`2[[System.Threading.Tasks.Task`1[[System.Int32]]],[``0]], scheduler:System.Threading.Tasks.TaskScheduler):System.Threading.Tasks.Task`1[[``0]]]} ICSharpCode.NRefactory.TypeSystem.Implementation.SpecializedMethod
[9] {[SpecializedMethod System.Threading.Tasks.Task`1[[System.Int32]].ContinueWith[``0](continuationFunction:System.Func`2[[System.Threading.Tasks.Task`1[[System.Int32]]],[``0]], cancellationToken:System.Threading.CancellationToken, continuationOptions:System.Threading.Tasks.TaskContinuationOptions, scheduler:System.Threading.Tasks.TaskScheduler):System.Threading.Tasks.Task`1[[``0]]]} ICSharpCode.NRefactory.TypeSystem.Implementation.SpecializedMethod
[10] {[SpecializedMethod System.Threading.Tasks.Task`1[[System.Int32]].ContinueWith(continuationAction:System.Action`2[[System.Threading.Tasks.Task`1[[System.Int32]]],[System.Object]], state:System.Object, cancellationToken:System.Threading.CancellationToken, continuationOptions:System.Threading.Tasks.TaskContinuationOptions, scheduler:System.Threading.Tasks.TaskScheduler):System.Threading.Tasks.Task]} ICSharpCode.NRefactory.TypeSystem.Implementation.SpecializedMethod
[11] {[SpecializedMethod System.Threading.Tasks.Task`1[[System.Int32]].ContinueWith(continuationAction:System.Action`2[[System.Threading.Tasks.Task`1[[System.Int32]]],[System.Object]], state:System.Object):System.Threading.Tasks.Task]} ICSharpCode.NRefactory.TypeSystem.Implementation.SpecializedMethod
[12] {[SpecializedMethod System.Threading.Tasks.Task`1[[System.Int32]].ContinueWith(continuationAction:System.Action`2[[System.Threading.Tasks.Task`1[[System.Int32]]],[System.Object]], state:System.Object, cancellationToken:System.Threading.CancellationToken):System.Threading.Tasks.Task]} ICSharpCode.NRefactory.TypeSystem.Implementation.SpecializedMethod
[13] {[SpecializedMethod System.Threading.Tasks.Task`1[[System.Int32]].ContinueWith(continuationAction:System.Action`2[[System.Threading.Tasks.Task`1[[System.Int32]]],[System.Object]], state:System.Object, continuationOptions:System.Threading.Tasks.TaskContinuationOptions):System.Threading.Tasks.Task]} ICSharpCode.NRefactory.TypeSystem.Implementation.SpecializedMethod
[14] {[SpecializedMethod System.Threading.Tasks.Task`1[[System.Int32]].ContinueWith(continuationAction:System.Action`2[[System.Threading.Tasks.Task`1[[System.Int32]]],[System.Object]], state:System.Object, scheduler:System.Threading.Tasks.TaskScheduler):System.Threading.Tasks.Task]} ICSharpCode.NRefactory.TypeSystem.Implementation.SpecializedMethod
[15] {[SpecializedMethod System.Threading.Tasks.Task`1[[System.Int32]].ContinueWith[``0](continuationFunction:System.Func`3[[System.Threading.Tasks.Task`1[[System.Int32]]],[System.Object],[``0]], state:System.Object):System.Threading.Tasks.Task`1[[``0]]]} ICSharpCode.NRefactory.TypeSystem.Implementation.SpecializedMethod
[16] {[SpecializedMethod System.Threading.Tasks.Task`1[[System.Int32]].ContinueWith[``0](continuationFunction:System.Func`3[[System.Threading.Tasks.Task`1[[System.Int32]]],[System.Object],[``0]], state:System.Object, cancellationToken:System.Threading.CancellationToken):System.Threading.Tasks.Task`1[[``0]]]} ICSharpCode.NRefactory.TypeSystem.Implementation.SpecializedMethod
[17] {[SpecializedMethod System.Threading.Tasks.Task`1[[System.Int32]].ContinueWith[``0](continuationFunction:System.Func`3[[System.Threading.Tasks.Task`1[[System.Int32]]],[System.Object],[``0]], state:System.Object, continuationOptions:System.Threading.Tasks.TaskContinuationOptions):System.Threading.Tasks.Task`1[[``0]]]} ICSharpCode.NRefactory.TypeSystem.Implementation.SpecializedMethod
[18] {[SpecializedMethod System.Threading.Tasks.Task`1[[System.Int32]].ContinueWith[``0](continuationFunction:System.Func`3[[System.Threading.Tasks.Task`1[[System.Int32]]],[System.Object],[``0]], state:System.Object, scheduler:System.Threading.Tasks.TaskScheduler):System.Threading.Tasks.Task`1[[``0]]]} ICSharpCode.NRefactory.TypeSystem.Implementation.SpecializedMethod
[19] {[SpecializedMethod System.Threading.Tasks.Task`1[[System.Int32]].ContinueWith[``0](continuationFunction:System.Func`3[[System.Threading.Tasks.Task`1[[System.Int32]]],[System.Object],[``0]], state:System.Object, cancellationToken:System.Threading.CancellationToken, continuationOptions:System.Threading.Tasks.TaskContinuationOptions, scheduler:System.Threading.Tasks.TaskScheduler):System.Threading.Tasks.Task`1[[``0]]]} ICSharpCode.NRefactory.TypeSystem.Implementation.SpecializedMethod
I've checked the resolve result of the whole invocation (CSharpInvocationResolveResult) and I get:
Windows (with the IsFaulted line):
+ lambdaResolveResult {[CSharpInvocationResolveResult [SpecializedMethod System.Threading.Tasks.Task.ContinueWith[?](continuationFunction:System.Func`2[[System.Threading.Tasks.Task],[?]]):System.Threading.Tasks.Task`1[[?]]]]} ICSharpCode.NRefactory.CSharp.Resolver.CSharpInvocationResolveResult
Windows (without the IsFaulted line):
+ lambdaResolveResult {[CSharpInvocationResolveResult [SpecializedMethod System.Threading.Tasks.Task`1[[System.Int32]].ContinueWith(continuationAction:System.Action`1[[System.Threading.Tasks.Task`1[[System.Int32]]]]):System.Threading.Tasks.Task]]} ICSharpCode.NRefactory.CSharp.Resolver.CSharpInvocationResolveResult
Linux:
lambdaResolveResult {[CSharpInvocationResolveResult [SpecializedMethod System.Threading.Tasks.Task`1[[System.Int32]].ContinueWith(continuationAction:System.Action`1[[System.Threading.Tasks.Task`1[[System.Int32]]]]):System.Threading.Tasks.Task]]} ICSharpCode.NRefactory.CSharp.Resolver.CSharpInvocationResolveResult
So that pretty much confirms NRefactory is picking the wrong overload of ContinueWith on Windows.
Here's the full resolver log: https://gist.github.com/dgrunwald/7442645
Note that Console cannot be resolved, due to a missing using System; Once that is added, the resolver picks the correct overload and the test passes.
Confirmed. Adding using System; does fix this problem (and the AutoAsyncTests as well).
I'll update my other pull request.
Still, I wonder why NRefactory on Linux recovers from this error when NRefactory on Windows fails.
On Linux, this is the resolver log: https://gist.github.com/luiscubal/7548131