Skip to content

Commit 042c0fb

Browse files
committed
WIP validation source generator
1 parent 976e770 commit 042c0fb

File tree

73 files changed

+633
-339
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+633
-339
lines changed

eng/Version.Details.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Dependencies>
22
<ProductDependencies>
3-
<Dependency Name="Microsoft.AspNetCore.App.Runtime.win-x64" Version="10.0.0-preview.3.25172.1" CoherentParentDependency="VS.Redist.Common.NetCore.SdkPlaceholder.x64.10.0">
3+
<Dependency Name="Microsoft.AspNetCore.App.Runtime.win-x64" Version="10.0.0-preview.4.25174.9" CoherentParentDependency="VS.Redist.Common.NetCore.SdkPlaceholder.x64.10.0">
44
<Uri>https://github.com/dotnet/aspnetcore</Uri>
55
<Sha>de35e2b0a0d8d5d1e307907983a6838da1092898</Sha>
66
</Dependency>
@@ -46,19 +46,19 @@
4646
<Uri>https://github.com/dotnet/diagnostics</Uri>
4747
<Sha>b1037b7cc1ef0b00a9032f19a83b074a00c9a4b8</Sha>
4848
</Dependency>
49-
<Dependency Name="Microsoft.NETCore.App.Runtime.win-x64" Version="10.0.0-preview.3.25171.5" CoherentParentDependency="VS.Redist.Common.NetCore.SdkPlaceholder.x64.10.0">
49+
<Dependency Name="Microsoft.NETCore.App.Runtime.win-x64" Version="10.0.0-preview.4.25174.9" CoherentParentDependency="VS.Redist.Common.NetCore.SdkPlaceholder.x64.10.0">
5050
<Uri>https://github.com/dotnet/runtime</Uri>
5151
<Sha>0a33e18a0bccc10a0c4646dbf5b0fc70cbb3aa44</Sha>
5252
</Dependency>
53-
<Dependency Name="VS.Redist.Common.AspNetCore.SharedFramework.x64.10.0" Version="10.0.0-preview.3.25172.1" CoherentParentDependency="VS.Redist.Common.NetCore.SdkPlaceholder.x64.10.0">
53+
<Dependency Name="VS.Redist.Common.AspNetCore.SharedFramework.x64.10.0" Version="10.0.0-preview.4.25174.9" CoherentParentDependency="VS.Redist.Common.NetCore.SdkPlaceholder.x64.10.0">
5454
<Uri>https://github.com/dotnet/aspnetcore</Uri>
5555
<Sha>de35e2b0a0d8d5d1e307907983a6838da1092898</Sha>
5656
</Dependency>
5757
<Dependency Name="VS.Redist.Common.NetCore.SdkPlaceholder.x64.10.0" Version="10.0.100-preview.3.25201.16">
5858
<Uri>https://github.com/dotnet/sdk</Uri>
5959
<Sha>9dee3cf508254bc3859d9cd2fe96aeb2ad1b9751</Sha>
6060
</Dependency>
61-
<Dependency Name="VS.Redist.Common.NetCore.SharedFramework.x64.10.0" Version="10.0.0-preview.3.25171.5" CoherentParentDependency="VS.Redist.Common.NetCore.SdkPlaceholder.x64.10.0">
61+
<Dependency Name="VS.Redist.Common.NetCore.SharedFramework.x64.10.0" Version="10.0.0-preview.34.25174.9" CoherentParentDependency="VS.Redist.Common.NetCore.SdkPlaceholder.x64.10.0">
6262
<Uri>https://github.com/dotnet/runtime</Uri>
6363
<Sha>0a33e18a0bccc10a0c4646dbf5b0fc70cbb3aa44</Sha>
6464
</Dependency>

eng/Versions.props

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@
5252
<MicrosoftDotNetCodeAnalysisVersion>10.0.0-beta.25202.1</MicrosoftDotNetCodeAnalysisVersion>
5353
<MicrosoftDotNetXUnitExtensionsVersion>10.0.0-beta.25202.1</MicrosoftDotNetXUnitExtensionsVersion>
5454
<!-- dotnet/aspnetcore references -->
55-
<MicrosoftAspNetCoreAppRuntimewinx64Version>10.0.0-preview.3.25172.1</MicrosoftAspNetCoreAppRuntimewinx64Version>
56-
<VSRedistCommonAspNetCoreSharedFrameworkx64100Version>10.0.0-preview.3.25172.1</VSRedistCommonAspNetCoreSharedFrameworkx64100Version>
55+
<MicrosoftAspNetCoreAppRuntimewinx64Version>10.0.0-preview.4.25181.4</MicrosoftAspNetCoreAppRuntimewinx64Version>
56+
<VSRedistCommonAspNetCoreSharedFrameworkx64100Version>10.0.0-preview.4.25181.4</VSRedistCommonAspNetCoreSharedFrameworkx64100Version>
5757
<!-- dotnet/command-line-api references -->
5858
<SystemCommandLineVersion>2.0.0-beta5.25170.1</SystemCommandLineVersion>
5959
<!-- dotnet/diagnostics references -->
@@ -62,8 +62,8 @@
6262
<!-- dotnet/roslyn-analyzers -->
6363
<MicrosoftCodeAnalysisNetAnalyzersVersion>10.0.0-preview.25076.4</MicrosoftCodeAnalysisNetAnalyzersVersion>
6464
<!-- dotnet/runtime references -->
65-
<MicrosoftNETCoreAppRuntimewinx64Version>10.0.0-preview.3.25171.5</MicrosoftNETCoreAppRuntimewinx64Version>
66-
<VSRedistCommonNetCoreSharedFrameworkx64100Version>10.0.0-preview.3.25171.5</VSRedistCommonNetCoreSharedFrameworkx64100Version>
65+
<MicrosoftNETCoreAppRuntimewinx64Version>10.0.0-preview.4.25174.9</MicrosoftNETCoreAppRuntimewinx64Version>
66+
<VSRedistCommonNetCoreSharedFrameworkx64100Version>10.0.0-preview.3.25174.9</VSRedistCommonNetCoreSharedFrameworkx64100Version>
6767
<!-- dotnet/sdk references -->
6868
<VSRedistCommonNetCoreSdkPlaceholderx64100Version>10.0.100-preview.3.25201.16</VSRedistCommonNetCoreSdkPlaceholderx64100Version>
6969
<!-- dotnet/symstore references -->
@@ -131,7 +131,7 @@
131131
<MicrosoftAspNetCoreAuthenticationNegotiateVersion>$(MicrosoftAspNetCoreApp100Version)</MicrosoftAspNetCoreAuthenticationNegotiateVersion>
132132
<MicrosoftExtensionsConfigurationAbstractionsVersion>$(MicrosoftNETCoreApp100Version)</MicrosoftExtensionsConfigurationAbstractionsVersion>
133133
<MicrosoftExtensionsLoggingVersion>$(MicrosoftNETCoreApp100Version)</MicrosoftExtensionsLoggingVersion>
134-
<MicrosoftExtensionsLoggingAbstractionsVersion>$(MicrosoftNETCoreApp100Version)</MicrosoftExtensionsLoggingAbstractionsVersion>
134+
<MicrosoftExtensionsLoggingAbstractionsVersion>$(MicrosoftExtensionsLoggingAbstractions100Version)</MicrosoftExtensionsLoggingAbstractionsVersion>
135135
<MicrosoftExtensionsLoggingConsoleVersion>$(MicrosoftNETCoreApp100Version)</MicrosoftExtensionsLoggingConsoleVersion>
136136
<SystemTextJsonVersion>$(MicrosoftNETCoreApp100Version)</SystemTextJsonVersion>
137137
<MicrosoftAspNetCoreOpenApiVersion>$(MicrosoftAspNetCoreApp100Version)</MicrosoftAspNetCoreOpenApiVersion>

eng/dependabot/net10.0/Versions.props

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
<!-- Import references updated by Dependabot. -->
33
<PropertyGroup>
44
<!-- Microsoft.NETCore.App -->
5-
<MicrosoftNETCoreApp100Version>10.0.0-preview.4.25174.9</MicrosoftNETCoreApp100Version>
65
<!-- Microsoft.Extensions.Configuration.Abstractions -->
76
<MicrosoftExtensionsConfigurationAbstractions100Version>$(MicrosoftNETCoreApp100Version)</MicrosoftExtensionsConfigurationAbstractions100Version>
87
<!-- Microsoft.Extensions.Logging -->
@@ -13,5 +12,7 @@
1312
<MicrosoftExtensionsLoggingConsole100Version>$(MicrosoftNETCoreApp100Version)</MicrosoftExtensionsLoggingConsole100Version>
1413
<!-- System.Text.Json -->
1514
<SystemTextJson100Version>$(MicrosoftNETCoreApp100Version)</SystemTextJson100Version>
15+
<!-- Microsoft.Extensions.Loggincg.Abstractions -->
16+
<MicrosoftExtensionsLoggingAbstractions100Version>10.0.0-preview.4.25180.1</MicrosoftExtensionsLoggingAbstractions100Version>
1617
</PropertyGroup>
1718
</Project>

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"tools": {
3-
"dotnet": "10.0.100-preview.3.25178.6",
3+
"dotnet": "10.0.100-preview.4.25202.23",
44
"runtimes": {
55
"aspnetcore": [
66
"$(MicrosoftAspNetCoreApp60Version)",

src/Directory.Build.targets

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,24 @@
1313
<EmbeddedFiles Include="$(GeneratedAssemblyInfoFile)"/>
1414
</ItemGroup>
1515

16+
<PropertyGroup>
17+
<DotNetHostGeneratedFileName>$(IntermediateOutputPath)/$(TargetFramework)/TestDotNetHost.g.cs</DotNetHostGeneratedFileName>
18+
<NetCoreAppVersion Condition="'$(TargetFramework)' == 'netcoreapp3.1'">$(MicrosoftNETCoreApp31Version)</NetCoreAppVersion>
19+
<NetCoreAppVersion Condition="'$(TargetFramework)' == 'net5.0'">$(MicrosoftNETCoreApp50Version)</NetCoreAppVersion>
20+
<NetCoreAppVersion Condition="'$(TargetFramework)' == 'net6.0'">$(MicrosoftNETCoreApp60Version)</NetCoreAppVersion>
21+
<NetCoreAppVersion Condition="'$(TargetFramework)' == 'net7.0'">$(MicrosoftNETCoreApp70Version)</NetCoreAppVersion>
22+
<NetCoreAppVersion Condition="'$(TargetFramework)' == 'net8.0'">$(MicrosoftNETCoreApp80Version)</NetCoreAppVersion>
23+
<NetCoreAppVersion Condition="'$(TargetFramework)' == 'net9.0'">$(MicrosoftNETCoreApp90Version)</NetCoreAppVersion>
24+
<NetCoreAppVersion Condition="'$(TargetFramework)' == 'net10.0'">$(MicrosoftNETCoreApp100Version)</NetCoreAppVersion>
25+
<AspNetCoreAppVersion Condition="'$(TargetFramework)' == 'netcoreapp3.1'">$(MicrosoftAspNetCoreApp31Version)</AspNetCoreAppVersion>
26+
<AspNetCoreAppVersion Condition="'$(TargetFramework)' == 'net5.0'">$(MicrosoftAspNetCoreApp50Version)</AspNetCoreAppVersion>
27+
<AspNetCoreAppVersion Condition="'$(TargetFramework)' == 'net6.0'">$(MicrosoftAspNetCoreApp60Version)</AspNetCoreAppVersion>
28+
<AspNetCoreAppVersion Condition="'$(TargetFramework)' == 'net7.0'">$(MicrosoftAspNetCoreApp70Version)</AspNetCoreAppVersion>
29+
<AspNetCoreAppVersion Condition="'$(TargetFramework)' == 'net8.0'">$(MicrosoftAspNetCoreApp80Version)</AspNetCoreAppVersion>
30+
<AspNetCoreAppVersion Condition="'$(TargetFramework)' == 'net9.0'">$(MicrosoftAspNetCoreApp90Version)</AspNetCoreAppVersion>
31+
<AspNetCoreAppVersion Condition="'$(TargetFramework)' == 'net10.0'">$(MicrosoftAspNetCoreApp100Version)</AspNetCoreAppVersion>
32+
</PropertyGroup>
33+
1634
<Target Name="GetDocumentationFile"
1735
Returns="@(DocFileItem)" />
1836

src/Extensions/S3Storage/S3StorageEgressProviderOptions.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using System;
55
using System.ComponentModel.DataAnnotations;
6+
using System.Diagnostics.CodeAnalysis;
67

78
namespace Microsoft.Diagnostics.Monitoring.Extension.S3Storage
89
{
@@ -51,6 +52,7 @@ internal sealed partial class S3StorageEgressProviderOptions
5152
ResourceType = typeof(OptionsDisplayStrings),
5253
Description = nameof(OptionsDisplayStrings.DisplayAttributeDescription_S3StorageEgressProviderOptions_PreSignedUrlExpiry))]
5354
[Range(typeof(TimeSpan), "00:01:00", "1.00:00:00")]
55+
[UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Addressed by DynamicDependency on ValidationHelper.TryValidateOptions method")]
5456
public TimeSpan? PreSignedUrlExpiry { get; set; }
5557

5658
[Display(

src/Microsoft.Diagnostics.Monitoring.Options/Microsoft.Diagnostics.Monitoring.Options.csproj

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project>
2+
3+
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk.Web" />
24

35
<PropertyGroup>
46
<!--
@@ -9,6 +11,7 @@
911
<IsShippingAssembly>true</IsShippingAssembly>
1012
<OutputType>Library</OutputType>
1113
<Nullable>enable</Nullable>
14+
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
1215
</PropertyGroup>
1316

1417
<ItemGroup>
@@ -39,4 +42,21 @@
3942
<Generator>PublicResXFileCodeGenerator</Generator>
4043
</EmbeddedResource>
4144
</ItemGroup>
45+
46+
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk.Web" />
47+
48+
<ItemGroup>
49+
<KnownFrameworkReference
50+
Update="Microsoft.NETCore.App"
51+
TargetingPackVersion="$(NetCoreAppVersion)"
52+
DefaultRuntimeFrameworkVersion="$(NetCoreAppVersion)"
53+
LatestRuntimeFrameworkVersion="$(NetCoreAppVersion)" />
54+
55+
<KnownFrameworkReference
56+
Update="Microsoft.AspNetCore.App"
57+
TargetingPackVersion="$(AspNetCoreAppVersion)"
58+
DefaultRuntimeFrameworkVersion="$(AspNetCoreAppVersion)"
59+
LatestRuntimeFrameworkVersion="$(AspNetCoreAppVersion)" />
60+
</ItemGroup>
61+
4262
</Project>

src/Microsoft.Diagnostics.Monitoring.WebApi/HostRestrictionMiddleware.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using Microsoft.AspNetCore.Builder;
55
using Microsoft.AspNetCore.Http;
66
using System.Threading.Tasks;
7-
using System;
87
using System.Linq;
98

109
namespace Microsoft.Diagnostics.Monitoring.WebApi
@@ -33,7 +32,6 @@ public async Task InvokeAsync(HttpContext context)
3332
var metadata = context.GetEndpoint()?.Metadata.GetMetadata<HostRestrictionAttribute>();
3433
if (metadata != null)
3534
{
36-
Console.WriteLine("type? " + metadata.GetType());
3735
var _restrictedPorts = _metricsPortsProvider.MetricsPorts.ToArray();
3836
if (_restrictedPorts.Any(port => context.Request.Host.Port == port))
3937
{

src/Microsoft.Diagnostics.Monitoring.WebApi/Models/Activity.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class Activity
1212
public string Id { get; set; } = string.Empty;
1313

1414
[JsonPropertyName("idFormat")]
15-
[JsonConverter(typeof(JsonStringEnumConverter))]
15+
[JsonConverter(typeof(JsonStringEnumConverter<ActivityIdFormat>))]
1616
public ActivityIdFormat IdFormat { get; set; } = ActivityIdFormat.Unknown;
1717
}
1818
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
using System.Collections.Generic;
5+
using System.Text.Json.Serialization;
6+
using Microsoft.Diagnostics.Monitoring.WebApi.Models;
7+
using Microsoft.Diagnostics.Monitoring.Options;
8+
9+
namespace Microsoft.Diagnostics.Monitoring.WebApi
10+
{
11+
[JsonSerializable(typeof(CaptureParametersConfiguration))]
12+
[JsonSerializable(typeof(EventMetricsConfiguration))]
13+
[JsonSerializable(typeof(EventPipeConfiguration))]
14+
[JsonSerializable(typeof(ExceptionsConfiguration))]
15+
[JsonSerializable(typeof(LogsConfiguration))]
16+
[JsonSerializable(typeof(IList<ProcessIdentifier>))]
17+
partial class MonitorJsonSerializerContext : JsonSerializerContext
18+
{
19+
}
20+
}

0 commit comments

Comments
 (0)