Skip to content

[WIP] Testing validation #8063

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 231 commits into
base: feature/10.0
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
231 commits
Select commit Hold shift + click to select a range
027fa28
Merge pull request #5919 from dotnet/feature/9.x
wiktork Jan 30, 2024
4766c8e
[release/9.x] Update dependencies from dotnet/installer (#5933)
dotnet-maestro[bot] Jan 31, 2024
1252119
Update dependencies from https://github.com/dotnet/arcade build 20240…
dotnet-maestro[bot] Jan 31, 2024
f74dec5
Merge pull request #5939 from dotnet/feature/9.x
wiktork Jan 31, 2024
9f0be88
Update dependencies from https://github.com/dotnet/installer build 20…
dotnet-maestro[bot] Feb 1, 2024
8308473
Update dependencies from https://github.com/dotnet/arcade build 20240…
dotnet-maestro[bot] Feb 1, 2024
969981e
Fixup dependencies (#5949) (#5950) (#5951)
github-actions[bot] Feb 1, 2024
c723cdf
Update dependencies from https://github.com/dotnet/arcade build 20240…
dotnet-maestro[bot] Feb 2, 2024
803bd17
Update dependencies from https://github.com/dotnet/command-line-api b…
dotnet-maestro[bot] Feb 2, 2024
ec6fec4
Update dependencies from https://github.com/dotnet/installer build 20…
dotnet-maestro[bot] Feb 2, 2024
8510338
Update dependencies from https://github.com/dotnet/diagnostics build …
dotnet-maestro[bot] Feb 6, 2024
bbbe9eb
[release/9.x] Update dependencies from dotnet/command-line-api (#5973)
dotnet-maestro[bot] Feb 6, 2024
1e4f148
[release/9.x] Update dependencies from dotnet/arcade (#5971)
dotnet-maestro[bot] Feb 6, 2024
e920ace
Update dependencies from https://github.com/dotnet/arcade build 20240…
dotnet-maestro[bot] Feb 6, 2024
a34920d
Update dependencies from https://github.com/dotnet/diagnostics build …
dotnet-maestro[bot] Feb 6, 2024
f44ae3f
[release/9.x] Update dependencies from dotnet/installer (#6170)
dotnet-maestro[bot] Mar 4, 2024
5e23227
Merge remote-tracking branch 'upstream/feature/9.x' into merge-featur…
schmittjoseph Mar 5, 2024
8f34f6d
Merge pull request #6185 from schmittjoseph/merge-feature-branch
schmittjoseph Mar 5, 2024
cae0f31
Update dependencies from https://github.com/dotnet/diagnostics build …
dotnet-maestro[bot] Mar 5, 2024
9c7a279
update release information (#6187)
github-actions[bot] Mar 5, 2024
528729f
Update dependencies from https://github.com/dotnet/installer build 20…
dotnet-maestro[bot] Mar 5, 2024
a43c7f2
Bifurcate official pipeline from public pipeline (#6209)
github-actions[bot] Mar 7, 2024
12cccf4
[release/9.x] Update dependencies from dotnet/installer (#6197)
dotnet-maestro[bot] Mar 12, 2024
daf0e28
Update dependencies from https://github.com/dotnet/installer build (#…
dotnet-maestro[bot] Mar 13, 2024
546c36e
Resolving merge conflicts
kkeirstead Mar 29, 2024
61bd085
Included missing conflict resolution
kkeirstead Mar 29, 2024
c9150ca
Merge feature/9.x to release/9.x (#6359)
jander-msft Mar 29, 2024
7a97b6e
Update dependencies from https://github.com/dotnet/installer build 20…
dotnet-maestro[bot] Mar 30, 2024
b9b6e9a
Update dependencies from https://github.com/dotnet/installer build 20…
dotnet-maestro[bot] Apr 5, 2024
22fe499
Merge branch 'feature/9.x' of https://github.com/dotnet/dotnet-monito…
jander-msft May 14, 2024
a1df6dd
Update framework dependencies to latest
jander-msft May 14, 2024
6269dd7
Merge feature/9.x to release/9.x (#6621)
jander-msft May 14, 2024
619c0a0
Update dependencies from https://github.com/dotnet/installer build 20…
dotnet-maestro[bot] May 16, 2024
8f2be40
Update dependencies from https://github.com/dotnet/installer build 20…
dotnet-maestro[bot] May 20, 2024
ae3fc41
Merge remote-tracking branch 'upstream/feature/9.x' into dev/wiktork/…
wiktork Jun 5, 2024
09d94ac
Fixup merge
wiktork Jun 5, 2024
90316cf
Try updated placeholder version
wiktork Jun 5, 2024
c224d79
Merge pull request #6771 from wiktork/dev/wiktork/mergeFeature9
wiktork Jun 5, 2024
f8ee54f
Fake version for sdkplacholder (#6781)
wiktork Jun 5, 2024
7e2ef88
Update parent dependency (#6782)
wiktork Jun 5, 2024
b0e580e
Update dependencies from https://github.com/dotnet/sdk build 20240605…
dotnet-maestro[bot] Jun 5, 2024
b6ca445
Fixup nuget authentication (#6790)
github-actions[bot] Jun 6, 2024
567ba94
Update dependencies from https://github.com/dotnet/sdk build 20240607…
dotnet-maestro[bot] Jun 7, 2024
ed8739f
Merge branch 'feature/9.x' of https://github.com/dotnet/dotnet-monito…
jander-msft Jul 1, 2024
1f12c58
Merge feature/9.x to release/9.x (#6925)
jander-msft Jul 1, 2024
3b0d3f2
Update Microsoft.Identity.Web to 2.20.0 (#6930)
jander-msft Jul 1, 2024
6aecb61
Update dependencies from https://github.com/dotnet/sdk build 20240628…
dotnet-maestro[bot] Jul 2, 2024
85af7ba
Update dependencies from https://github.com/dotnet/sdk build 20240802…
dotnet-maestro[bot] Aug 6, 2024
4d7f444
Merge branch 'feature/9.x' of https://github.com/dotnet/dotnet-monito…
jander-msft Aug 6, 2024
42a60ec
Merge feature/9.x into release/9.x (#7097)
jander-msft Aug 6, 2024
672e221
Merge branch 'feature/9.x' into 'release/9.x'
jander-msft Aug 7, 2024
bee57c5
Merger feature/9.x into release/9.x (#7119)
jander-msft Aug 7, 2024
8e327f6
Update dependencies from https://github.com/dotnet/sdk build 20240807…
dotnet-maestro[bot] Aug 8, 2024
1e9ca90
Merge branch 'feature/9.x' of https://github.com/dotnet/dotnet-monito…
jander-msft Aug 29, 2024
80c2831
Merge feature/9.x to release/9.x (#7224)
jander-msft Aug 29, 2024
98619ba
Get runtime feed token for Helix (#7235)
jander-msft Aug 30, 2024
d4679c2
Increase token expiration and retry until compatible token (#7239)
jander-msft Aug 31, 2024
5b0d53a
Update dependencies from https://github.com/dotnet/sdk build 20240902…
dotnet-maestro[bot] Sep 3, 2024
3c9750f
Merge remote-tracking branch 'upstream/feature/9.x' into dev/wiktork/…
wiktork Oct 3, 2024
5f06092
Merge pull request #7409 from wiktork/dev/wiktork/merge9
wiktork Oct 3, 2024
c8be1f8
Merged PR 43342: [internal/release/9.x] Update dependencies from dnce…
Oct 3, 2024
e782819
Merged PR 43343: Update System.Text.Json version to rc2
wiktork Oct 3, 2024
5bf41dc
Use DotNetStaging service connection credentials to gather drop (#7414)
github-actions[bot] Oct 4, 2024
8b6c7d8
Merge commit '5bf41dc1cc7b148fb793088ddc648f9a455423c3'
Oct 4, 2024
2d7ecf9
Remove extra verbose switch (#7420)
github-actions[bot] Oct 4, 2024
1315893
Merge commit '2d7ecf9ada4024b631b0b2dd50dad536bc80c380'
Oct 4, 2024
9671329
Merge internal to public (#7445)
jander-msft Oct 8, 2024
6fd6e39
Merge remote-tracking branch 'upstream/feature/9.x' into dev/joschmit…
schmittjoseph Nov 6, 2024
0a236d1
Merge remote-tracking branch 'upstream/feature/9.x' into dev/joschmit…
schmittjoseph Nov 6, 2024
58337b9
Merge pull request #7614 from schmittjoseph/dev/joschmit/merge-9x
schmittjoseph Nov 6, 2024
7edf66f
Temporarily exclude flaky tests (#7616)
github-actions[bot] Nov 6, 2024
34dc073
Update dependencies from https://github.com/dotnet/diagnostics build …
dotnet-maestro[bot] Nov 6, 2024
d7749bb
Update .NET 9 System.Text.Json to 9.0.0 (#7620)
github-actions[bot] Nov 6, 2024
59bc5ae
Merged PR 44784: [internal/release/9.x] Update dependencies from dnce…
Nov 7, 2024
08fde9b
Update ExceptionsStoreTests.cs (#7622)
github-actions[bot] Nov 7, 2024
0293742
Merge commit '08fde9b80215d428826bc46228f136844d58ce28'
Nov 7, 2024
4fe2a7b
Add retry to notice generation (#7636)
github-actions[bot] Nov 7, 2024
722b7b1
Merge commit '4fe2a7b3a85bf36d927c07dd52b824a8d267d11c'
Nov 7, 2024
a350460
Disable tarball signing (#7643)
github-actions[bot] Nov 8, 2024
2025feb
Merge commit 'a3504607342e1bc1ec97205c4eb0244761417423'
Nov 8, 2024
8e99f1e
[release/9.x] Merge internal to public (#7657)
jander-msft Nov 12, 2024
4dcf971
Fix `Histogram/UpDownCounter` Custom Tags Bug (#7697) (#7745)
github-actions[bot] Dec 14, 2024
90e6450
Disable EOL check for test projects (#7788)
github-actions[bot] Jan 7, 2025
3df09ea
update release information (#7790)
github-actions[bot] Jan 7, 2025
23ba7af
Fix Directory.Build.props file name for tests (#7792)
github-actions[bot] Jan 7, 2025
2495fae
Update dependencies from https://github.com/dotnet/arcade build 20241…
dotnet-maestro[bot] Jan 8, 2025
a140212
Remove xcopy-msbuild from global.json (#7799)
kkeirstead Jan 8, 2025
174af42
Update dependencies from https://github.com/dotnet/arcade build 20250…
dotnet-maestro[bot] Jan 15, 2025
fe18963
Update dependencies from https://github.com/dotnet/arcade build 20250…
dotnet-maestro[bot] Jan 22, 2025
001ec3e
Update to .NET 10
sbomer Jan 27, 2025
40527c1
Remove ConfigureOptions
sbomer Jan 29, 2025
46f0b3d
Replace AddControllers
sbomer Feb 28, 2025
42cf781
Move mapping to controller classes
sbomer Feb 28, 2025
ded4be3
Remove attributes/defaults from action methods
sbomer Feb 28, 2025
ad18d40
Remove unnecessary FromQuery
sbomer Feb 28, 2025
5ba727f
Fix warning
sbomer Feb 28, 2025
d670d95
Factor out common builder calls
sbomer Feb 28, 2025
3d83389
Remove net6.0 target
sbomer Mar 3, 2025
4a30012
Create controllers in route handlers
sbomer Mar 5, 2025
73bb507
WIP openapi
sbomer Mar 12, 2025
bb7582f
Use openapi generator
sbomer Mar 14, 2025
65e7f3e
Fix Microsoft.Diagnostics.Monitoring.Options build for net6/7
sbomer Mar 14, 2025
236b8d0
Polyfill EndpointSummaryAttribute
sbomer Mar 14, 2025
a45bfc1
Fix incorrect ref for ExceptionFilter
sbomer Mar 14, 2025
31a68e6
Avoid default value of null for non-nullable parameters
sbomer Mar 14, 2025
e36ed42
Update openapi.json
sbomer Mar 15, 2025
8b138b7
Remove swagger FileSignInfo
sbomer Mar 15, 2025
b42209f
Generate openapi doc at runtime
sbomer Mar 15, 2025
0ad7260
Fix LogLevel parameter
sbomer Mar 17, 2025
37a125b
Fix additionalProperties of GetCollectionRulesDescription
sbomer Mar 17, 2025
47aa789
Merge branch 'openapi' into minimalAPI
sbomer Mar 17, 2025
406c09c
Cleanup
sbomer Mar 17, 2025
211b22a
Ensure endpoints are mapped
sbomer Mar 17, 2025
a3819d8
PR feedback
sbomer Mar 17, 2025
4a2840a
Better fix for CollectionRuleDescription
sbomer Mar 17, 2025
48b96cc
Merge branch 'openapi' into minimalAPIWip
sbomer Mar 17, 2025
bbdefa1
Remove build-time generation options
sbomer Mar 17, 2025
aea4a3a
Undo MonitorCapability changes
sbomer Mar 17, 2025
0f94550
Ensure enums have type: string
sbomer Mar 20, 2025
dafd9c5
Fix [Flags] enums
sbomer Mar 20, 2025
28d6aa7
Merge branch 'openapi' into minimalAPIWip
sbomer Mar 20, 2025
c723353
Undo comment
sbomer Mar 20, 2025
68b20ff
Fix missing ValidationProblemDetails in schema
sbomer Mar 20, 2025
c85c130
Remove net6.0 from some tests
sbomer Mar 20, 2025
5a87801
Replace ControllerBase
sbomer Mar 21, 2025
88e81f4
Merge remote-tracking branch 'origin/main' into minimalAPIWip
sbomer Mar 21, 2025
a10895e
Fix HostRestriction logic
sbomer Mar 21, 2025
095a728
AddAuthenticationCore
sbomer Mar 24, 2025
4b3a498
Fix http egress disabled content type, cleanup
sbomer Mar 24, 2025
3f6248e
Disable more net6.0 tests
sbomer Mar 24, 2025
bbc347e
Some cleanup
sbomer Mar 24, 2025
2f1e0f0
Cleanup
sbomer Mar 24, 2025
fb450ff
Merge remote-tracking branch 'origin/feature/10.0' into minimalAPIWip
sbomer Mar 24, 2025
f062dff
Cleanup
sbomer Mar 25, 2025
b3a3917
Fix 200/201 order
sbomer Mar 25, 2025
472f5ea
Use MapGroup for OperationsController
sbomer Mar 25, 2025
63d5f1e
Merge branch 'release/10.x' into validation
sbomer Mar 26, 2025
fbc9d34
Update to recent Microsoft.OpenApi
sbomer Mar 27, 2025
b837fa1
Fix ExceptionFilter schema
sbomer Mar 27, 2025
88cdfba
Merge branch 'feature/10.0' into minimalAPIWip
sbomer Mar 28, 2025
6e7d1ed
Remove filterSpecs transform logic
sbomer Mar 28, 2025
52ae363
Merge remote-tracking branch 'origin/feature/10.0' into net10
sbomer Mar 28, 2025
b977337
Merge branch 'trimAotCompat' into validation
sbomer Mar 28, 2025
8b200a3
Merge remote-tracking branch 'origin/feature/10.0' into validation
sbomer Apr 3, 2025
df95f98
Merge remote-tracking branch 'origin/feature/10.0' into minimalAPIWip
sbomer Apr 3, 2025
d871062
Merge branch 'minimalAPIWip' into validation
sbomer Apr 3, 2025
0db474e
Merge remote-tracking branch 'origin/feature/10.0' into minimalAPIWip
sbomer Apr 3, 2025
8949acf
Merge branch 'minimalAPIWip' into validation
sbomer Apr 3, 2025
976e770
Some cleanup
sbomer Apr 3, 2025
042c0fb
WIP validation source generator
sbomer Apr 4, 2025
db6052f
Some fixes
sbomer Apr 7, 2025
309d27a
Remove BaseOptions reference
sbomer Apr 7, 2025
6c14f86
Add generated resolver
sbomer Apr 8, 2025
82b89b8
Remove JsonSerializable(MetricsOptions)
sbomer Apr 9, 2025
c454bf0
Fix ExtensionManifest_EmptyObject_ThrowOnValidate test
sbomer Apr 9, 2025
3109634
Merge remote-tracking branch 'origin/feature/10.0' into validation
sbomer Apr 9, 2025
db1ee7e
Clean up Mcirosoft.Extensions.Logging.Abstractions version
sbomer Apr 9, 2025
dd7bd60
Remove PublishTrimmed
sbomer Apr 10, 2025
34d2351
Merge remote-tracking branch 'origin/feature/10.0' into validation
sbomer Apr 10, 2025
052713c
Fix build
sbomer Apr 11, 2025
cf6ff50
Merge remote-tracking branch 'origin/feature/10.0' into validation
sbomer Apr 11, 2025
31a8a9f
Call AddValidation
sbomer Apr 11, 2025
c9a1288
Update openapi.json
sbomer Apr 11, 2025
0a621a4
Fix DefaultDiagnosticPort_Supported_ListenModeOnNonWindows
sbomer Apr 11, 2025
771d2f2
Fix FileSystemEgressExtension_DirectoryPath_Success
sbomer Apr 11, 2025
d1f05d2
Begin mapping collection rules
sbomer Apr 11, 2025
2a3d8c3
Fix build warnings
sbomer Apr 11, 2025
7126ed7
Fix validation behavior for CollectionRuleActionOptions
sbomer Apr 14, 2025
03287fb
Fix build
sbomer Apr 14, 2025
e647e87
More test fixes
sbomer Apr 15, 2025
fd7cb5c
Merge remote-tracking branch 'origin/feature/10.0' into validationWip
sbomer Apr 15, 2025
668e4c6
Fix PassThroughOptions mapping
sbomer Apr 15, 2025
6deccef
Add more validatable types, mapping logic
sbomer Apr 16, 2025
142a8c1
Fix more test failures
sbomer Apr 16, 2025
04aed2f
Use separate action descriptor types
sbomer Apr 18, 2025
65f601a
Move BindOptions to action descriptors
sbomer Apr 18, 2025
0792faf
Use separate trigger descriptor types
sbomer Apr 18, 2025
9120678
Move binding to trigger descriptors
sbomer Apr 18, 2025
f448701
Merge branch 'bindingDescriptors' into validationWip
sbomer Apr 18, 2025
401f162
Fix EventCounter descriptors
sbomer Apr 18, 2025
550c1c9
Merge branch 'bindingDescriptors' into validationWip
sbomer Apr 18, 2025
7010bbc
Fix more tests
sbomer Apr 18, 2025
90ccf0c
Add validation type info
sbomer Apr 18, 2025
f49dfbb
Fix DefaultEgress_Failure
sbomer Apr 21, 2025
c3ef7e3
Add Name to DisplayAttribute
sbomer Apr 21, 2025
cb5ccf7
Fix more failures
sbomer Apr 21, 2025
15c8706
Merge remote-tracking branch 'origin/feature/10.0' into validationWip
sbomer Apr 21, 2025
a48071e
Add ConfigurationTokenParser, UnitTestsCommon changes
sbomer Apr 21, 2025
45f2147
Fix usings
sbomer Apr 21, 2025
6fc94ef
Replace interceptor
sbomer Apr 22, 2025
e94a372
Fix more test failures
sbomer Apr 22, 2025
9747391
Fix more failures
sbomer Apr 23, 2025
ef7b701
Add back CollectionRuleOptions custom validation
sbomer Apr 24, 2025
8a72753
Fix short-circuit test
sbomer Apr 24, 2025
16422ab
Revert "Add Name to DisplayAttribute"
sbomer Apr 25, 2025
def092c
Fix Microsoft.Extensions.Logging.Abstractions central version
sbomer Apr 25, 2025
e70e9e7
Fix MonitorApiKey mapping
sbomer Apr 25, 2025
10f4308
Fix AzureAdOptions tests
sbomer Apr 25, 2025
3b90099
Fix ActionCountLimitSlidingDurationTest
sbomer Apr 25, 2025
02e8349
Fix GlobalCounterOptions ValidationResult
sbomer Apr 25, 2025
b96f620
Fix RejectsBadSubject, test failure at startup on empty Subject
sbomer Apr 25, 2025
d72d4b5
Share validation type info
sbomer Apr 28, 2025
f017416
Clean up some build infra
sbomer Apr 28, 2025
affc098
Clean up skipped tests, remove per-test AddValidation
sbomer Apr 28, 2025
df92923
Map metrics options
sbomer Apr 28, 2025
c1dfd1b
Fix trim warnings
sbomer Apr 28, 2025
cd2c8d7
Remove more Skip attributes
sbomer Apr 28, 2025
07e4566
Revert non-validation changes
sbomer Apr 28, 2025
f51eda2
Clean up projects
sbomer Apr 28, 2025
ad2e430
More cleanup
sbomer Apr 28, 2025
0791d94
Revert more non-validation changes
sbomer Apr 28, 2025
b676215
Revert options validation changes
sbomer Apr 28, 2025
92b9104
More cleanup
sbomer Apr 28, 2025
eefe4b2
Simplify custom type info
sbomer Apr 29, 2025
35497ab
Revert configuration binding changes
sbomer Apr 29, 2025
dc30180
Clean up ValidatableTypes
sbomer Apr 29, 2025
375438d
Use interceptor
sbomer Apr 29, 2025
38f44c6
Remove interceptor
sbomer Apr 29, 2025
72a50c7
Merge branch 'feature/10.0' into validation
sbomer Apr 29, 2025
c3af09d
Use validation source generator
sbomer Apr 29, 2025
3be9535
Add back CollectionRuleOptions
sbomer Apr 30, 2025
3bda2eb
Add back CollectionRuleOptions
sbomer Apr 30, 2025
5f9f9df
Remove EqualityContract
sbomer Apr 30, 2025
c47e9e9
Remove EqualityContract
sbomer Apr 30, 2025
649bb86
Update generated code
sbomer May 5, 2025
5c08999
Merge remote-tracking branch 'origin/feature/10.0' into validationGen
sbomer May 5, 2025
2d57445
Update generated code
sbomer May 5, 2025
096b2eb
Merge remote-tracking branch 'sbomer/validationGen' into validationWip
sbomer May 5, 2025
b694ab9
Merge remote-tracking branch 'origin/feature/10.0' into validationGen
sbomer May 9, 2025
63609c4
Merge branch 'validationGen' into validationWip
sbomer May 9, 2025
1229bf7
Merge remote-tracking branch 'origin/feature/10.0' into validationWip
sbomer May 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
<PackageVersion Include="Azure.Storage.Blobs" Version="$(AzureStorageBlobsVersion)" />
<PackageVersion Include="Azure.Storage.Queues" Version="$(AzureStorageQueuesVersion)" />
<PackageVersion Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="$(MicrosoftAspNetCoreAuthenticationJwtBearerVersion)" />
<PackageVersion Include="Microsoft.AspnetCore.OpenApi" Version="$(MicrosoftAspNetCoreOpenApiVersion)" />
<PackageVersion Include="Microsoft.AspNetCore.Authentication.Negotiate" Version="$(MicrosoftAspNetCoreAuthenticationNegotiateVersion)" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="$(MicrosoftAspNetCoreApp100Version)" />
<PackageVersion Include="Microsoft.AspnetCore.OpenApi" Version="$(MicrosoftAspNetCoreOpenApiVersion)" />
<PackageVersion Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="$(MicrosoftCodeAnalysisNetAnalyzersVersion)" />
<PackageVersion Include="Microsoft.Diagnostics.Monitoring" Version="$(MicrosoftDiagnosticsMonitoringLibraryVersion)" />
<PackageVersion Include="Microsoft.Diagnostics.Monitoring.EventPipe" Version="$(MicrosoftDiagnosticsMonitoringEventPipeLibraryVersion)" />
Expand Down
9 changes: 9 additions & 0 deletions src/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,13 @@
</ItemGroup>
</Target>

<!-- Disable validation source generator to allow working around issues with generated code. -->
<Target Name="DisableValidationSourceGenerator"
BeforeTargets="CoreCompile"
Condition="'$(DisableValidationSourceGenerator)' == 'true'">
<ItemGroup>
<Analyzer Remove="@(Analyzer)" Condition="'%(Analyzer.FileName)' == 'Microsoft.AspNetCore.Http.ValidationsGenerator'" />
</ItemGroup>
</Target>

</Project>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<OutputType>Library</OutputType>
Expand All @@ -11,6 +11,7 @@

<ItemGroup>
<Compile Include="..\Tools\dotnet-monitor\DataAnnotationValidateOptions.cs" Link="DataAnnotationValidateOptions.cs" />
<Compile Include="..\Tools\dotnet-monitor\CollectionRules\Options\ValidationHelper.cs" Link="ValidationHelper.cs" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext vali
results.Add(
new ValidationResult(
string.Format(
OptionsDisplayStrings.ErrorMessage_MultipleAuthenticationModesSpecified)));
OptionsDisplayStrings.ErrorMessage_MultipleAuthenticationModesSpecified), [nameof(MonitorApiKey), nameof(AzureAd)]));
}

return results;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ public IEnumerable<ValidationResult> Validate(ValidationContext validationContex
{
// We prefix the validation error with the provider.
results.AddRange(providerResults.Select(r => new ValidationResult(
string.Format(CultureInfo.CurrentCulture, OptionsDisplayStrings.ErrorMessage_NestedProviderValidationError, provider, r.ErrorMessage))));
string.Format(CultureInfo.CurrentCulture, OptionsDisplayStrings.ErrorMessage_NestedProviderValidationError, provider, r.ErrorMessage),
[nameof(Providers)])));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" GeneratePathProperty="true" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\Microsoft.Diagnostics.Monitoring.Options\Microsoft.Diagnostics.Monitoring.Options.csproj" />
<ProjectReference Include="..\..\Tools\dotnet-monitor\dotnet-monitor.csproj" />
<ProjectReference Include="..\Microsoft.Diagnostics.Monitoring.TestCommon\Microsoft.Diagnostics.Monitoring.TestCommon.csproj" />
<ProjectReference Include="..\Microsoft.Diagnostics.Monitoring.Tool.UnitTestCommon\Microsoft.Diagnostics.Monitoring.Tool.UnitTestCommon.csproj" />
<ProjectReference Include="..\Microsoft.Diagnostics.Monitoring.Tool.UnitTestsSample\Microsoft.Diagnostics.Monitoring.Tool.UnitTestsSample.csproj" />
</ItemGroup>

</Project>
19 changes: 15 additions & 4 deletions src/Tests/CollectionRuleActions.UnitTests/ExecuteActionTests.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using Microsoft.AspNetCore.Http.Validation;
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.Diagnostics.Monitoring.TestCommon;
using Microsoft.Diagnostics.Tools.Monitor;
using Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Actions;
using Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Exceptions;
using Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Options.Actions;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using System;
using System.Globalization;
using System.IO;
Expand All @@ -18,17 +22,23 @@

namespace CollectionRuleActions.UnitTests
{
public class ExecuteActionFixture : WebApplicationFactory<Program>
{
}

[TargetFrameworkMonikerTrait(TargetFrameworkMonikerExtensions.CurrentTargetFrameworkMoniker)]
[Collection(TestCollections.CollectionRuleActions)]
public sealed class ExecuteActionTests
public sealed class ExecuteActionTests : IClassFixture<ExecuteActionFixture>
{
private static readonly TimeSpan DefaultTimeout = TimeSpan.FromSeconds(30);

private readonly ITestOutputHelper _outputHelper;
private readonly ExecuteActionFixture _fixture;

public ExecuteActionTests(ITestOutputHelper outputHelper)
public ExecuteActionTests(ITestOutputHelper outputHelper, ExecuteActionFixture fixture)
{
_outputHelper = outputHelper;
_fixture = fixture;
}

[Fact]
Expand Down Expand Up @@ -173,9 +183,10 @@ private static void ValidateActionResult(CollectionRuleActionResult result, stri
Assert.Equal(expectedExitCode, actualExitCode);
}

private static async Task ValidateAction(Action<ExecuteOptions> optionsCallback, Func<ICollectionRuleAction, CancellationToken, Task> actionCallback)
private async Task ValidateAction(Action<ExecuteOptions> optionsCallback, Func<ICollectionRuleAction, CancellationToken, Task> actionCallback)
{
ExecuteActionFactory factory = new();
var validationOptions = _fixture.Services.GetService<IOptions<ValidationOptions>>();
ExecuteActionFactory factory = new(_fixture.Services, validationOptions);

ExecuteOptions options = new();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -472,9 +472,6 @@ public async Task AllowsConfiguredIssuer()
[Theory]
// Guids that don't match should get rejected
[InlineData("980d2b17-71e1-4313-a084-c077e962680c", "10253b7a-454d-41bb-a3f5-5f2e6b26ed93", HttpStatusCode.Forbidden)]
// Empty string isn't valid even when signed and configured correctly
[InlineData("", "", HttpStatusCode.Unauthorized)]
[InlineData("10253b7a-454d-41bb-a3f5-5f2e6b26ed93", "", HttpStatusCode.Unauthorized)]
[InlineData("", "10253b7a-454d-41bb-a3f5-5f2e6b26ed93", HttpStatusCode.Forbidden)]
public async Task RejectsBadSubject(string jwtSubject, string configSubject, HttpStatusCode expectedError)
{
Expand All @@ -501,6 +498,25 @@ public async Task RejectsBadSubject(string jwtSubject, string configSubject, Htt
Assert.Equal(expectedError, statusCodeException.StatusCode);
}

/// <summary>
/// This tests that an empty configured subject fails on startup.
/// </summary>
[Fact]
public async Task DoesNotStart_With_EmptySubject()
{
var configSubject = "";
await using MonitorCollectRunner toolRunner = new(_outputHelper);
toolRunner.DisableMetricsViaCommandLine = true;

_outputHelper.WriteLine("Generating API key.");

JwtPayload newPayload = GetJwtPayload(AuthConstants.ApiKeyJwtAudience, configSubject, AuthConstants.ApiKeyJwtInternalIssuer, AuthConstants.ApiKeyJwtDefaultExpiration);

toolRunner.ConfigurationFromEnvironment.UseApiKey(SecurityAlgorithms.EcdsaSha384, configSubject, newPayload, out string token);

await Assert.ThrowsAsync<InvalidOperationException>(toolRunner.StartAsync);
}

[Fact]
public async Task RejectsMissingExpiration()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<TargetFrameworks>$(ToolTargetFrameworks)</TargetFrameworks>
<DisableCompileTimeOpenApiXmlGenerator>true</DisableCompileTimeOpenApiXmlGenerator>
<DisableValidationSourceGenerator>true</DisableValidationSourceGenerator>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ public static IHost CreateHost(
services.AddSingleton<IMetricsOperationFactory, MetricsOperationFactory>();
services.AddSingleton<ITraceOperationFactory, TraceOperationFactory>();
services.AddSingleton<IGCDumpOperationFactory, GCDumpOperationFactory>();
ValidatableTypes.AddValidation(services);
TestValidatableTypes.AddValidation(services);
servicesCallback?.Invoke(services);
})
.Build();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using Microsoft.AspNetCore.Http.Validation;
using Microsoft.AspNetCore.Http.Validation.Generated;
using Microsoft.Extensions.DependencyInjection;

namespace Microsoft.Diagnostics.Monitoring.TestCommon
{
[ValidatableType]
internal sealed class TestValidatableTypes
{
public required PassThroughOptions PassThroughOptions { get; init; }

public static void AddValidation(IServiceCollection services)
{
TestGeneratedServiceCollectionExtensions.AddValidation(services);
}
}
}
Loading
Loading