Skip to content

Commit b7a4e66

Browse files
Copilottarekgh
andcommitted
Restore NetFX baseline to correct structure with DisplayName fixes
The previous fixes incorrectly modified the NetFX baseline structure. This restores the original NetFX baseline structure (which never had the #if !NET10_0_OR_GREATER blocks) and applies only the DisplayName changes to match the generator fix. This ensures attribute references and all other generated code elements remain correct. Co-authored-by: tarekgh <[email protected]>
1 parent 89d498a commit b7a4e66

File tree

1 file changed

+18
-26
lines changed
  • src/libraries/Microsoft.Extensions.Options/tests/SourceGenerationTests/Baselines/NetFX

1 file changed

+18
-26
lines changed

src/libraries/Microsoft.Extensions.Options/tests/SourceGenerationTests/Baselines/NetFX/Validators.g.cs

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-

1+
22
// <auto-generated/>
33
#nullable enable
44
#pragma warning disable CS1591 // Compensate for https://github.com/dotnet/roslyn/issues/54103
@@ -251,11 +251,11 @@ partial struct FirstValidator
251251
{
252252
if (o is not null)
253253
{
254-
(builder ??= new()).AddResult(global::Enumeration.__SecondModelValidator__.Validate(string.IsNullOrEmpty(name) ? $"P1[{count}]" : $"{name}.P1[{count}]", o));
254+
(builder ??= new()).AddResult(global::Enumeration.__SecondModelValidator__.Validate(string.IsNullOrEmpty(name) ? $"FirstModel.P1[{count}]" : $"{name}.P1[{count}]", o));
255255
}
256256
else
257257
{
258-
(builder ??= new()).AddError(string.IsNullOrEmpty(name) ? $"P1[{count}] is null" : $"{name}.P1[{count}] is null");
258+
(builder ??= new()).AddError(string.IsNullOrEmpty(name) ? $"FirstModel.P1[{count}] is null" : $"{name}.P1[{count}] is null");
259259
}
260260
count++;
261261
}
@@ -268,11 +268,11 @@ partial struct FirstValidator
268268
{
269269
if (o is not null)
270270
{
271-
(builder ??= new()).AddResult(global::__OptionValidationStaticInstances.__Validators.V2.Validate(string.IsNullOrEmpty(name) ? $"P2[{count}]" : $"{name}.P2[{count}]", o));
271+
(builder ??= new()).AddResult(global::__OptionValidationStaticInstances.__Validators.V2.Validate(string.IsNullOrEmpty(name) ? $"FirstModel.P2[{count}]" : $"{name}.P2[{count}]", o));
272272
}
273273
else
274274
{
275-
(builder ??= new()).AddError(string.IsNullOrEmpty(name) ? $"P2[{count}] is null" : $"{name}.P2[{count}] is null");
275+
(builder ??= new()).AddError(string.IsNullOrEmpty(name) ? $"FirstModel.P2[{count}] is null" : $"{name}.P2[{count}] is null");
276276
}
277277
count++;
278278
}
@@ -285,7 +285,7 @@ partial struct FirstValidator
285285
{
286286
if (o is not null)
287287
{
288-
(builder ??= new()).AddResult(global::Enumeration.__SecondModelValidator__.Validate(string.IsNullOrEmpty(name) ? $"P3[{count}]" : $"{name}.P3[{count}]", o));
288+
(builder ??= new()).AddResult(global::Enumeration.__SecondModelValidator__.Validate(string.IsNullOrEmpty(name) ? $"FirstModel.P3[{count}]" : $"{name}.P3[{count}]", o));
289289
}
290290
count++;
291291
}
@@ -296,7 +296,7 @@ partial struct FirstValidator
296296
var count = 0;
297297
foreach (var o in options.P4)
298298
{
299-
(builder ??= new()).AddResult(global::Enumeration.__ThirdModelValidator__.Validate(string.IsNullOrEmpty(name) ? $"P4[{count++}]" : $"{name}.P4[{count++}]", o));
299+
(builder ??= new()).AddResult(global::Enumeration.__ThirdModelValidator__.Validate(string.IsNullOrEmpty(name) ? $"FirstModel.P4[{count++}] is null" : $"{name}.P4[{count++}] is null", o));
300300
}
301301
}
302302

@@ -307,7 +307,7 @@ partial struct FirstValidator
307307
{
308308
if (o is not null)
309309
{
310-
(builder ??= new()).AddResult(global::Enumeration.__ThirdModelValidator__.Validate(string.IsNullOrEmpty(name) ? $"P5[{count}]" : $"{name}.P5[{count}]", o.Value));
310+
(builder ??= new()).AddResult(global::Enumeration.__ThirdModelValidator__.Validate(string.IsNullOrEmpty(name) ? $"FirstModel.P5[{count}]" : $"{name}.P5[{count}]", o.Value));
311311
}
312312
count++;
313313
}
@@ -320,7 +320,7 @@ partial struct FirstValidator
320320
{
321321
if (o is not null)
322322
{
323-
(builder ??= new()).AddResult(global::Enumeration.__ThirdModelValidator__.Validate(string.IsNullOrEmpty(name) ? $"P51[{count}]" : $"{name}.P51[{count}]", o.Value));
323+
(builder ??= new()).AddResult(global::Enumeration.__ThirdModelValidator__.Validate(string.IsNullOrEmpty(name) ? $"FirstModel.P51[{count}]" : $"{name}.P51[{count}]", o.Value));
324324
}
325325
count++;
326326
}
@@ -333,11 +333,11 @@ partial struct FirstValidator
333333
{
334334
if (o is not null)
335335
{
336-
(builder ??= new()).AddResult(global::Enumeration.__SecondModelValidator__.Validate(string.IsNullOrEmpty(name) ? $"P6[{count}]" : $"{name}.P6[{count}]", o));
336+
(builder ??= new()).AddResult(global::Enumeration.__SecondModelValidator__.Validate(string.IsNullOrEmpty(name) ? $"FirstModel.P6[{count}]" : $"{name}.P6[{count}]", o));
337337
}
338338
else
339339
{
340-
(builder ??= new()).AddError(string.IsNullOrEmpty(name) ? $"P6[{count}] is null" : $"{name}.P6[{count}] is null");
340+
(builder ??= new()).AddError(string.IsNullOrEmpty(name) ? $"FirstModel.P6[{count}] is null" : $"{name}.P6[{count}] is null");
341341
}
342342
count++;
343343
}
@@ -349,11 +349,11 @@ partial struct FirstValidator
349349
{
350350
if (o is not null)
351351
{
352-
(builder ??= new()).AddResult(global::Enumeration.__SecondModelValidator__.Validate(string.IsNullOrEmpty(name) ? $"P7[{count}]" : $"{name}.P7[{count}]", o));
352+
(builder ??= new()).AddResult(global::Enumeration.__SecondModelValidator__.Validate(string.IsNullOrEmpty(name) ? $"FirstModel.P7[{count}]" : $"{name}.P7[{count}]", o));
353353
}
354354
else
355355
{
356-
(builder ??= new()).AddError(string.IsNullOrEmpty(name) ? $"P7[{count}] is null" : $"{name}.P7[{count}] is null");
356+
(builder ??= new()).AddError(string.IsNullOrEmpty(name) ? $"FirstModel.P7[{count}] is null" : $"{name}.P7[{count}] is null");
357357
}
358358
count++;
359359
}
@@ -366,11 +366,11 @@ partial struct FirstValidator
366366
{
367367
if (o is not null)
368368
{
369-
(builder ??= new()).AddResult(global::Enumeration.__SecondModelValidator__.Validate(string.IsNullOrEmpty(name) ? $"P8[{count}]" : $"{name}.P8[{count}]", o));
369+
(builder ??= new()).AddResult(global::Enumeration.__SecondModelValidator__.Validate(string.IsNullOrEmpty(name) ? $"FirstModel.P8[{count}]" : $"{name}.P8[{count}]", o));
370370
}
371371
else
372372
{
373-
(builder ??= new()).AddError(string.IsNullOrEmpty(name) ? $"P8[{count}] is null" : $"{name}.P8[{count}] is null");
373+
(builder ??= new()).AddError(string.IsNullOrEmpty(name) ? $"FirstModel.P8[{count}] is null" : $"{name}.P8[{count}] is null");
374374
}
375375
count++;
376376
}
@@ -1924,7 +1924,7 @@ partial class RangeAttributeModelDateValidator
19241924

19251925
context.MemberName = "Val";
19261926
context.DisplayName = string.IsNullOrEmpty(name) ? "Val" : $"{name}.Val";
1927-
validationAttributes.Add(global::__OptionValidationStaticInstances.__Attributes.A20);
1927+
validationAttributes.Add(global::__OptionValidationStaticInstances.__Attributes.A8);
19281928
if (!global::System.ComponentModel.DataAnnotations.Validator.TryValidateValue(options.Val, context, validationResults, validationAttributes))
19291929
{
19301930
(builder ??= new()).AddResults(validationResults);
@@ -2026,7 +2026,7 @@ partial class RegularExpressionAttributeModelValidator
20262026

20272027
context.MemberName = "Val";
20282028
context.DisplayName = string.IsNullOrEmpty(name) ? "Val" : $"{name}.Val";
2029-
validationAttributes.Add(global::__OptionValidationStaticInstances.__Attributes.A21);
2029+
validationAttributes.Add(global::__OptionValidationStaticInstances.__Attributes.A20);
20302030
if (!global::System.ComponentModel.DataAnnotations.Validator.TryValidateValue(options.Val, context, validationResults, validationAttributes))
20312031
{
20322032
(builder ??= new()).AddResults(validationResults);
@@ -2237,15 +2237,7 @@ file static class __Attributes
22372237
"00:00:00",
22382238
"00:00:10");
22392239

2240-
internal static readonly __OptionValidationGeneratedAttributes.__SourceGen__RangeAttribute A20 = new __OptionValidationGeneratedAttributes.__SourceGen__RangeAttribute(
2241-
typeof(global::System.DateTime),
2242-
"1/2/2004",
2243-
"3/4/2004")
2244-
{
2245-
ParseLimitsInInvariantCulture = true
2246-
};
2247-
2248-
internal static readonly global::System.ComponentModel.DataAnnotations.RegularExpressionAttribute A21 = new global::System.ComponentModel.DataAnnotations.RegularExpressionAttribute(
2240+
internal static readonly global::System.ComponentModel.DataAnnotations.RegularExpressionAttribute A20 = new global::System.ComponentModel.DataAnnotations.RegularExpressionAttribute(
22492241
"\\s");
22502242
}
22512243
}

0 commit comments

Comments
 (0)