125 references to ERR_AnonMethToNonDel
Microsoft.CodeAnalysis.CSharp (2)
Binder\Binder_Statements.cs (1)
2023
Error(diagnostics, ErrorCode.
ERR_AnonMethToNonDel
, syntax, id, targetType);
Errors\ErrorFacts.cs (1)
1257
case ErrorCode.
ERR_AnonMethToNonDel
:
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (5)
CodeGen\CodeGenTupleTest.cs (5)
7066
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "(t)=>t").WithArguments("lambda expression", "int").WithLocation(15, 17),
7123
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "(t)=>t").WithArguments("lambda expression", "int").WithLocation(15, 29),
7181
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "(t)=>t").WithArguments("lambda expression", "int").WithLocation(15, 17),
7237
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "(t)=>t").WithArguments("lambda expression", "string").WithLocation(15, 17),
7296
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "(t)=>t").WithArguments("lambda expression", "int").WithLocation(15, 18),
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (112)
Semantics\AnonymousFunctionTests.cs (2)
1361
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "static () => { }").WithArguments("lambda expression", "delegate*<void>").WithLocation(6, 31)
1403
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "static delegate() { }").WithArguments("anonymous method", "delegate*<void>").WithLocation(6, 31)
Semantics\DelegateTypeTests.cs (96)
92
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => { }").WithArguments("lambda expression", "System.Delegate").WithLocation(7, 13),
95
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "delegate () { }").WithArguments("anonymous method", "System.Delegate").WithLocation(8, 13),
98
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 1").WithArguments("lambda expression", "System.Linq.Expressions.Expression").WithLocation(9, 48));
312
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => { }").WithArguments("lambda expression", "object").WithLocation(6, 20),
315
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => { }").WithArguments("lambda expression", "System.ICloneable").WithLocation(7, 24),
318
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => { }").WithArguments("lambda expression", "System.Delegate").WithLocation(8, 22),
321
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => { }").WithArguments("lambda expression", "System.MulticastDelegate").WithLocation(9, 31));
356
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => { }").WithArguments("lambda expression", "object").WithLocation(6, 26),
359
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => { }").WithArguments("lambda expression", "System.ICloneable").WithLocation(7, 30),
362
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => { }").WithArguments("lambda expression", "System.Delegate").WithLocation(8, 28),
365
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => { }").WithArguments("lambda expression", "System.MulticastDelegate").WithLocation(9, 37));
397
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 1").WithArguments("lambda expression", "System.Linq.Expressions.Expression").WithLocation(7, 24),
400
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 2").WithArguments("lambda expression", "System.Linq.Expressions.Expression").WithLocation(9, 26));
430
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 1").WithArguments("lambda expression", "System.Linq.Expressions.LambdaExpression").WithLocation(7, 30),
433
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 2").WithArguments("lambda expression", "System.Linq.Expressions.LambdaExpression").WithLocation(9, 32));
464
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "x => x").WithArguments("lambda expression", "System.Delegate").WithLocation(7, 22),
467
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "x => x").WithArguments("lambda expression", "object").WithLocation(8, 29),
470
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "x => x").WithArguments("lambda expression", "System.Linq.Expressions.Expression").WithLocation(9, 24),
473
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "x => x").WithArguments("lambda expression", "System.Linq.Expressions.Expression").WithLocation(10, 26),
476
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "x => x").WithArguments("lambda expression", "System.Linq.Expressions.LambdaExpression").WithLocation(11, 30),
479
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "x => x").WithArguments("lambda expression", "System.Linq.Expressions.LambdaExpression").WithLocation(12, 32));
529
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 1").WithArguments("lambda expression", "System.Linq.Expressions.LambdaExpression<System.Func<int>>").WithLocation(7, 41),
532
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 2").WithArguments("lambda expression", "System.Linq.Expressions.LambdaExpression<System.Func<int>>").WithLocation(8, 43)
589
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "delegate () { }").WithArguments("anonymous method", "object").WithLocation(6, 20),
592
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "delegate () { }").WithArguments("anonymous method", "System.ICloneable").WithLocation(7, 24),
595
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "delegate () { }").WithArguments("anonymous method", "System.Delegate").WithLocation(8, 22),
598
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "delegate () { }").WithArguments("anonymous method", "System.MulticastDelegate").WithLocation(9, 31));
628
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "delegate () { return 1; }").WithArguments("anonymous method", "System.Linq.Expressions.Expression").WithLocation(6, 48),
631
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "delegate () { return 2; }").WithArguments("anonymous method", "System.Linq.Expressions.Expression").WithLocation(7, 25),
634
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "delegate () { return 3; }").WithArguments("anonymous method", "System.Linq.Expressions.LambdaExpression").WithLocation(8, 30),
637
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "delegate () { return 4; }").WithArguments("anonymous method", "System.Linq.Expressions.LambdaExpression").WithLocation(9, 31));
678
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 1").WithArguments("lambda expression", "dynamic").WithLocation(8, 13));
2301
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 1").WithArguments("lambda expression", "System.Delegate").WithLocation(7, 13),
2470
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 1").WithArguments("lambda expression", "System.Linq.Expressions.Expression").WithLocation(5, 48),
2646
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 1").WithArguments("lambda expression", "System.Linq.Expressions.Expression").WithLocation(5, 48));
2715
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 1").WithArguments("lambda expression", "System.Linq.Expressions.Expression").WithLocation(5, 49),
2718
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 2").WithArguments("lambda expression", "System.Linq.Expressions.LambdaExpression").WithLocation(6, 55),
2721
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 3").WithArguments("lambda expression", "System.Linq.Expressions.Expression<System.Func<int>>").WithLocation(7, 67));
2767
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 1").WithArguments("lambda expression", "Root.System.Linq.Expressions.Expression").WithLocation(7, 25),
2770
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 2").WithArguments("lambda expression", "Root.System.Linq.Expressions.LambdaExpression").WithLocation(8, 31),
2773
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 3").WithArguments("lambda expression", "Root.System.Linq.Expressions.Expression<System.Func<int>>").WithLocation(9, 36));
2912
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "(ref int i) => i").WithArguments("lambda expression", "System.Delegate").WithLocation(6, 13));
3165
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "delegate () { return 0; }").WithArguments("anonymous method", "System.Linq.Expressions.Expression").WithLocation(9, 11),
3168
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "delegate () { return string.Empty; }").WithArguments("anonymous method", "System.Linq.Expressions.Expression").WithLocation(10, 11));
3289
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "x => x").WithArguments("lambda expression", "System.Delegate").WithLocation(9, 12),
3295
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "x => x").WithArguments("lambda expression", "System.Linq.Expressions.Expression").WithLocation(11, 12));
4010
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 1").WithArguments("lambda expression", "object").WithLocation(10, 11),
4082
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 1").WithArguments("lambda expression", "System.Delegate").WithLocation(9, 11),
4085
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 1").WithArguments("lambda expression", "System.Delegate").WithLocation(10, 11));
4119
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 1").WithArguments("lambda expression", "System.Delegate").WithLocation(9, 11));
4151
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 1").WithArguments("lambda expression", "object").WithLocation(9, 11));
4183
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 1").WithArguments("lambda expression", "System.Delegate").WithLocation(12, 11),
4186
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 2").WithArguments("lambda expression", "System.Delegate").WithLocation(12, 20));
4255
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 1").WithArguments("lambda expression", "System.Linq.Expressions.Expression").WithLocation(9, 11));
4287
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 1").WithArguments("lambda expression", "System.Linq.Expressions.Expression").WithLocation(11, 11));
5205
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 1").WithArguments("lambda expression", "System.Delegate").WithLocation(7, 35),
5208
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 2").WithArguments("lambda expression", "System.Linq.Expressions.Expression").WithLocation(8, 37));
11511
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "(Employee e) => e.Name").WithArguments("lambda expression", "Program.Field").WithLocation(7, 20)
11553
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 1").WithArguments("lambda expression", "C1").WithLocation(16, 17),
11556
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 2").WithArguments("lambda expression", "C2").WithLocation(17, 17),
11608
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 1").WithArguments("lambda expression", "C1").WithLocation(15, 17),
11611
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 2").WithArguments("lambda expression", "C2").WithLocation(16, 17),
11620
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 1").WithArguments("lambda expression", "C1").WithLocation(19, 18),
11623
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 2").WithArguments("lambda expression", "C2").WithLocation(20, 18),
11685
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 1").WithArguments("lambda expression", "C1").WithLocation(24, 17),
11688
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 2").WithArguments("lambda expression", "C2").WithLocation(25, 17),
11691
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 3").WithArguments("lambda expression", "C3").WithLocation(26, 17),
11694
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 4").WithArguments("lambda expression", "C4").WithLocation(27, 17),
11703
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 1").WithArguments("lambda expression", "C1").WithLocation(30, 18),
11706
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 2").WithArguments("lambda expression", "C2").WithLocation(31, 18),
11709
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 3").WithArguments("lambda expression", "C3").WithLocation(32, 18),
11712
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 4").WithArguments("lambda expression", "C4").WithLocation(33, 18),
11757
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 1").WithArguments("lambda expression", "C<object>").WithLocation(11, 24),
11760
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 2").WithArguments("lambda expression", "C<System.ICloneable>").WithLocation(12, 28),
11769
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 1").WithArguments("lambda expression", "C<object>").WithLocation(15, 25),
11772
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 2").WithArguments("lambda expression", "C<System.ICloneable>").WithLocation(16, 29),
11822
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 1").WithArguments("lambda expression", "C<System.Delegate>").WithLocation(12, 26),
11825
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 2").WithArguments("lambda expression", "C<System.MulticastDelegate>").WithLocation(13, 35),
11828
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 3").WithArguments("lambda expression", "C<System.Linq.Expressions.Expression>").WithLocation(14, 28),
11831
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 4").WithArguments("lambda expression", "C<System.Linq.Expressions.LambdaExpression>").WithLocation(15, 34),
11840
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 1").WithArguments("lambda expression", "C<System.Delegate>").WithLocation(18, 27),
11843
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 2").WithArguments("lambda expression", "C<System.MulticastDelegate>").WithLocation(19, 36),
11846
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 3").WithArguments("lambda expression", "C<System.Linq.Expressions.Expression>").WithLocation(20, 29),
11849
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 4").WithArguments("lambda expression", "C<System.Linq.Expressions.LambdaExpression>").WithLocation(21, 35),
11934
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 1").WithArguments("lambda expression", "C1").WithLocation(15, 18),
11937
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 2").WithArguments("lambda expression", "C2").WithLocation(16, 18),
11993
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 1").WithArguments("lambda expression", "C1").WithLocation(24, 18),
11996
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 2").WithArguments("lambda expression", "C2").WithLocation(25, 18),
11999
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 3").WithArguments("lambda expression", "C3").WithLocation(26, 18),
12002
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 4").WithArguments("lambda expression", "C4").WithLocation(27, 18),
12043
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 1").WithArguments("lambda expression", "C<object>").WithLocation(11, 25),
12046
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 2").WithArguments("lambda expression", "C<System.ICloneable>").WithLocation(12, 29),
12090
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 1").WithArguments("lambda expression", "C<System.Delegate>").WithLocation(12, 27),
12093
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 2").WithArguments("lambda expression", "C<System.MulticastDelegate>").WithLocation(13, 36),
12096
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 3").WithArguments("lambda expression", "C<System.Linq.Expressions.Expression>").WithLocation(14, 29),
12099
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 4").WithArguments("lambda expression", "C<System.Linq.Expressions.LambdaExpression>").WithLocation(15, 35),
Semantics\DynamicTests.cs (1)
2610
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => {}").WithArguments("lambda expression", "dynamic").WithLocation(18, 17),
Semantics\FunctionPointerTests.cs (2)
2801
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "v => 0").WithArguments("lambda expression", "delegate*<string, int>").WithLocation(6, 38),
2804
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "v => 0").WithArguments("lambda expression", "delegate*<string, int>").WithLocation(7, 27)
Semantics\InterpolationTests.cs (1)
992
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "x=>3").WithArguments("lambda expression", "object").WithLocation(5, 35),
Semantics\LambdaTests.cs (4)
160
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "()=>1").WithArguments("lambda expression", "int").WithLocation(16, 18),
163
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "delegate { return 1; }").WithArguments("anonymous method", "int").WithLocation(17, 18),
724
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => x").WithArguments("lambda expression", "string").WithLocation(5, 37),
1170
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "(a, b) => c.Add").WithArguments("lambda expression", "System.Collections.Generic.IList<C>").WithLocation(9, 15));
Semantics\NullableReferenceTypesTests.cs (1)
2573
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => x").WithArguments("lambda expression", "string").WithLocation(4, 38)
Semantics\NullableReferenceTypesVsPatterns.cs (2)
2504
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => s.ToString()").WithArguments("lambda expression", "object").WithLocation(9, 21),
2510
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => s?.ToString()").WithArguments("lambda expression", "object").WithLocation(10, 22));
Semantics\OutVarTests.cs (1)
36341
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => { [My(M2(out var x))] static string M2(out int x) => throw null; }").WithArguments("lambda expression", "string").WithLocation(6, 13),
Semantics\SemanticErrorTests.cs (1)
15856
new ErrorDescription[] { new ErrorDescription { Code = (int)ErrorCode.
ERR_AnonMethToNonDel
, Line = 6, Column = 14 } });
Semantics\UnsafeTests.cs (1)
8240
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "x => x").WithArguments("lambda expression", "int"));
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (2)
Symbols\ConversionTests.cs (1)
1997
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "() => 1").WithArguments("lambda expression", "Q"),
Symbols\Source\NullablePublicAPITests.cs (1)
5045
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, @"() =>
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (4)
Parsing\AnonymousFunctionParsingTests.cs (4)
1165
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "static x => x").WithArguments("lambda expression", "int").WithLocation(1, 34));
1172
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "static x => x").WithArguments("lambda expression", "int").WithLocation(1, 34));
1798
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "static delegate(int x) { }").WithArguments("anonymous method", "int").WithLocation(1, 34));
1805
Diagnostic(ErrorCode.
ERR_AnonMethToNonDel
, "static delegate(int x) { }").WithArguments("anonymous method", "int").WithLocation(1, 34));