Skip to content

Commit 21c2418

Browse files
committed
Scrub out InterceptsLocationAttribute lines
1 parent b03f15a commit 21c2418

7 files changed

+12
-7
lines changed

src/Http/Http.Extensions/test/ValidationsGenerator/ValidationsGeneratorTestBase.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using System.Runtime.Loader;
88
using System.Text;
99
using System.Text.Json;
10+
using System.Text.RegularExpressions;
1011
using Microsoft.AspNetCore.Builder;
1112
using Microsoft.AspNetCore.Hosting.Server;
1213
using Microsoft.AspNetCore.Http.Features;
@@ -25,8 +26,11 @@
2526
namespace Microsoft.AspNetCore.Http.ValidationsGenerator.Tests;
2627

2728
[UsesVerify]
28-
public class ValidationsGeneratorTestBase : LoggedTestBase
29+
public partial class ValidationsGeneratorTestBase : LoggedTestBase
2930
{
31+
[GeneratedRegex(@"\[global::System\.Runtime\.CompilerServices\.InterceptsLocationAttribute\([^)]*\)\]")]
32+
private static partial Regex InterceptsLocationRegex();
33+
3034
private static readonly CSharpParseOptions ParseOptions = new CSharpParseOptions(LanguageVersion.Preview)
3135
.WithFeatures([new KeyValuePair<string, string>("InterceptorsNamespaces", "Microsoft.AspNetCore.Http.Validation.Generated")]);
3236

@@ -65,6 +69,7 @@ internal static Task Verify(string source, out Compilation compilation)
6569
var driver = CSharpGeneratorDriver.Create(generators: [generator.AsSourceGenerator()], parseOptions: ParseOptions);
6670
return Verifier
6771
.Verify(driver.RunGeneratorsAndUpdateCompilation(inputCompilation, out compilation, out var diagnostics))
72+
.ScrubLinesWithReplace(line => InterceptsLocationRegex().Replace(line, "[InterceptsLocation]"))
6873
.UseDirectory(SkipOnHelixAttribute.OnHelix()
6974
? Path.Combine(Environment.GetEnvironmentVariable("HELIX_WORKITEM_ROOT"), "ValidationsGenerator", "snapshots")
7075
: "snapshots");

src/Http/Http.Extensions/test/ValidationsGenerator/snapshots/ValidationsGeneratorTests.CanValidateComplexTypes#ValidatableInfoResolver.g.verified.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ private ValidatableTypeInfo CreateComplexType()
186186
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")]
187187
file static class GeneratedServiceCollectionExtensions
188188
{
189-
[global::System.Runtime.CompilerServices.InterceptsLocationAttribute(1, "I71YCOnkIuFyp29JNyKEXIEBAABQcm9ncmFtLmNz")]
189+
[InterceptsLocation]
190190
public static global::Microsoft.Extensions.DependencyInjection.IServiceCollection AddValidation(this global::Microsoft.Extensions.DependencyInjection.IServiceCollection services, global::System.Action<ValidationOptions>? configureOptions = null)
191191
{
192192
// Use non-extension method to avoid infinite recursion.

src/Http/Http.Extensions/test/ValidationsGenerator/snapshots/ValidationsGeneratorTests.CanValidateIValidatableObject#ValidatableInfoResolver.g.verified.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ private ValidatableTypeInfo CreateComplexValidatableType()
137137
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")]
138138
file static class GeneratedServiceCollectionExtensions
139139
{
140-
[global::System.Runtime.CompilerServices.InterceptsLocationAttribute(1, "uQnZr9MSHY6ZEeLkq015qrABAABQcm9ncmFtLmNz")]
140+
[InterceptsLocation]
141141
public static global::Microsoft.Extensions.DependencyInjection.IServiceCollection AddValidation(this global::Microsoft.Extensions.DependencyInjection.IServiceCollection services, global::System.Action<ValidationOptions>? configureOptions = null)
142142
{
143143
// Use non-extension method to avoid infinite recursion.

src/Http/Http.Extensions/test/ValidationsGenerator/snapshots/ValidationsGeneratorTests.CanValidateParameters#ValidatableInfoResolver.g.verified.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public bool TryGetValidatableParameterInfo(global::System.Reflection.ParameterIn
7575
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")]
7676
file static class GeneratedServiceCollectionExtensions
7777
{
78-
[global::System.Runtime.CompilerServices.InterceptsLocationAttribute(1, "85TK7bWNSSMP7r/P9i3t43YBAABQcm9ncmFtLmNz")]
78+
[InterceptsLocation]
7979
public static global::Microsoft.Extensions.DependencyInjection.IServiceCollection AddValidation(this global::Microsoft.Extensions.DependencyInjection.IServiceCollection services, global::System.Action<ValidationOptions>? configureOptions = null)
8080
{
8181
// Use non-extension method to avoid infinite recursion.

src/Http/Http.Extensions/test/ValidationsGenerator/snapshots/ValidationsGeneratorTests.CanValidatePolymorphicTypes#ValidatableInfoResolver.g.verified.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ private ValidatableTypeInfo CreateContainerType()
175175
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")]
176176
file static class GeneratedServiceCollectionExtensions
177177
{
178-
[global::System.Runtime.CompilerServices.InterceptsLocationAttribute(1, "2dHhUDyiknXJLaQw/hXAKIgBAABQcm9ncmFtLmNz")]
178+
[InterceptsLocation]
179179
public static global::Microsoft.Extensions.DependencyInjection.IServiceCollection AddValidation(this global::Microsoft.Extensions.DependencyInjection.IServiceCollection services, global::System.Action<ValidationOptions>? configureOptions = null)
180180
{
181181
// Use non-extension method to avoid infinite recursion.

src/Http/Http.Extensions/test/ValidationsGenerator/snapshots/ValidationsGeneratorTests.CanValidateRecursiveTypes#ValidatableInfoResolver.g.verified.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ private ValidatableTypeInfo CreateRecursiveType()
100100
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")]
101101
file static class GeneratedServiceCollectionExtensions
102102
{
103-
[global::System.Runtime.CompilerServices.InterceptsLocationAttribute(1, "wNU90FRNrQG/m6cp7QRaZQYBAABQcm9ncmFtLmNz")]
103+
[InterceptsLocation]
104104
public static global::Microsoft.Extensions.DependencyInjection.IServiceCollection AddValidation(this global::Microsoft.Extensions.DependencyInjection.IServiceCollection services, global::System.Action<ValidationOptions>? configureOptions = null)
105105
{
106106
// Use non-extension method to avoid infinite recursion.

src/Http/Http.Extensions/test/ValidationsGenerator/snapshots/ValidationsGeneratorTests.CanValidateTypesWithAttribute#ValidatableInfoResolver.g.verified.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ private ValidatableTypeInfo CreateComplexType()
180180
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")]
181181
file static class GeneratedServiceCollectionExtensions
182182
{
183-
[global::System.Runtime.CompilerServices.InterceptsLocationAttribute(1, "1zHOloYrguEmrREVCu+15nYBAABQcm9ncmFtLmNz")]
183+
[InterceptsLocation]
184184
public static global::Microsoft.Extensions.DependencyInjection.IServiceCollection AddValidation(this global::Microsoft.Extensions.DependencyInjection.IServiceCollection services, global::System.Action<ValidationOptions>? configureOptions = null)
185185
{
186186
// Use non-extension method to avoid infinite recursion.

0 commit comments

Comments
 (0)