You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// (6,15): error CS9202: Feature 'ref and unsafe in async and iterator methods' is not available in C# 12.0. Please use language version 13.0 or greater.
2092
+
// await foreach (var s in new C())
2093
+
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion12,"foreach").WithArguments("ref and unsafe in async and iterator methods","13.0").WithLocation(6,15));
2094
+
2086
2095
varexpectedDiagnostics=new[]
2087
2096
{
2088
-
// (6,15): error CS8344: foreach statement cannot operate on enumerators of type 'C.Enumerator' in async or iterator methods because 'C.Enumerator' is a ref struct.
2097
+
// (6,9): error CS4007: Instance of type 'C.Enumerator' cannot be preserved across 'await' or 'yield' boundary.
// (7,15): error CS9202: Feature 'ref and unsafe in async and iterator methods' is not available in C# 12.0. Please use language version 13.0 or greater.
2142
+
// await foreach (var x in new C())
2143
+
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion12,"foreach").WithArguments("ref and unsafe in async and iterator methods","13.0").WithLocation(7,15));
2121
2144
2122
2145
varexpectedDiagnostics=new[]
2123
2146
{
2124
-
// (7,15): error CS8344: foreach statement cannot operate on enumerators of type 'C.Enumerator' in async or iterator methods because 'C.Enumerator' is a ref struct.
2147
+
// (7,9): error CS4007: Instance of type 'C.Enumerator' cannot be preserved across 'await' or 'yield' boundary.
// (6,9): error CS9202: Feature 'ref and unsafe in async and iterator methods' is not available in C# 12.0. Please use language version 13.0 or greater.
2185
+
// foreach (var x in new C())
2186
+
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion12,"foreach").WithArguments("ref and unsafe in async and iterator methods","13.0").WithLocation(6,9));
2187
+
2157
2188
varexpectedDiagnostics=new[]
2158
2189
{
2159
-
// (6,9): error CS8344: foreach statement cannot operate on enumerators of type 'C.Enumerator' in async or iterator methods because 'C.Enumerator' is a ref struct.
2190
+
// (6,9): error CS4007: Instance of type 'C.Enumerator' cannot be preserved across 'await' or 'yield' boundary.
0 commit comments