Skip to content

Commit da1ad23

Browse files
authored
.Net Fix KernelParameterMetadata not compatible with C# 7.3 net472 (#12369)
### Motivation and Context - Fixes #12297
1 parent 6116f7d commit da1ad23

File tree

7 files changed

+235
-19
lines changed

7 files changed

+235
-19
lines changed

dotnet/src/Connectors/Connectors.Amazon.UnitTests/Services/BedrockChatCompletionServiceTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public void ShouldThrowExceptionForEmptyModelId()
7575
/// <summary>
7676
/// Checks that an invalid BedrockRuntime object will throw an exception.
7777
/// </summary>
78-
[Fact]
78+
[Fact(Skip = "For manual verification only")]
7979
public async Task ShouldThrowExceptionForNullBedrockRuntimeAsync()
8080
{
8181
// Arrange

dotnet/src/Connectors/Connectors.Amazon.UnitTests/Services/BedrockTextEmbeddingGenerationServiceTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public void ShouldThrowExceptionForEmptyModelId()
7474
/// <summary>
7575
/// Checks that an invalid BedrockRuntime object will throw an exception.
7676
/// </summary>
77-
[Fact]
77+
[Fact(Skip = "For manual verification only")]
7878
public async Task ShouldThrowExceptionForNullBedrockRuntimeWhenNotConfiguredAsync()
7979
{
8080
// Arrange

dotnet/src/Connectors/Connectors.Amazon.UnitTests/Services/BedrockTextGenerationServiceTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public void ShouldThrowExceptionForEmptyModelId()
7878
/// <summary>
7979
/// Checks that an invalid BedrockRuntime object will throw an exception.
8080
/// </summary>
81-
[Fact]
81+
[Fact(Skip = "For manual verification only")]
8282
public async Task ShouldThrowExceptionForNullBedrockRuntimeAsync()
8383
{
8484
// Arrange
Lines changed: 214 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,214 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- https://learn.microsoft.com/dotnet/fundamentals/package-validation/diagnostic-ids -->
3+
<Suppressions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
4+
<Suppression>
5+
<DiagnosticId>CP0002</DiagnosticId>
6+
<Target>M:Microsoft.SemanticKernel.KernelFunctionMetadata.set_AdditionalProperties(System.Collections.ObjectModel.ReadOnlyDictionary{System.String,System.Object})</Target>
7+
<Left>lib/net8.0/Microsoft.SemanticKernel.Abstractions.dll</Left>
8+
<Right>lib/net8.0/Microsoft.SemanticKernel.Abstractions.dll</Right>
9+
<IsBaselineSuppression>true</IsBaselineSuppression>
10+
</Suppression>
11+
<Suppression>
12+
<DiagnosticId>CP0002</DiagnosticId>
13+
<Target>M:Microsoft.SemanticKernel.KernelFunctionMetadata.set_Description(System.String)</Target>
14+
<Left>lib/net8.0/Microsoft.SemanticKernel.Abstractions.dll</Left>
15+
<Right>lib/net8.0/Microsoft.SemanticKernel.Abstractions.dll</Right>
16+
<IsBaselineSuppression>true</IsBaselineSuppression>
17+
</Suppression>
18+
<Suppression>
19+
<DiagnosticId>CP0002</DiagnosticId>
20+
<Target>M:Microsoft.SemanticKernel.KernelFunctionMetadata.set_Name(System.String)</Target>
21+
<Left>lib/net8.0/Microsoft.SemanticKernel.Abstractions.dll</Left>
22+
<Right>lib/net8.0/Microsoft.SemanticKernel.Abstractions.dll</Right>
23+
<IsBaselineSuppression>true</IsBaselineSuppression>
24+
</Suppression>
25+
<Suppression>
26+
<DiagnosticId>CP0002</DiagnosticId>
27+
<Target>M:Microsoft.SemanticKernel.KernelFunctionMetadata.set_Parameters(System.Collections.Generic.IReadOnlyList{Microsoft.SemanticKernel.KernelParameterMetadata})</Target>
28+
<Left>lib/net8.0/Microsoft.SemanticKernel.Abstractions.dll</Left>
29+
<Right>lib/net8.0/Microsoft.SemanticKernel.Abstractions.dll</Right>
30+
<IsBaselineSuppression>true</IsBaselineSuppression>
31+
</Suppression>
32+
<Suppression>
33+
<DiagnosticId>CP0002</DiagnosticId>
34+
<Target>M:Microsoft.SemanticKernel.KernelFunctionMetadata.set_PluginName(System.String)</Target>
35+
<Left>lib/net8.0/Microsoft.SemanticKernel.Abstractions.dll</Left>
36+
<Right>lib/net8.0/Microsoft.SemanticKernel.Abstractions.dll</Right>
37+
<IsBaselineSuppression>true</IsBaselineSuppression>
38+
</Suppression>
39+
<Suppression>
40+
<DiagnosticId>CP0002</DiagnosticId>
41+
<Target>M:Microsoft.SemanticKernel.KernelFunctionMetadata.set_ReturnParameter(Microsoft.SemanticKernel.KernelReturnParameterMetadata)</Target>
42+
<Left>lib/net8.0/Microsoft.SemanticKernel.Abstractions.dll</Left>
43+
<Right>lib/net8.0/Microsoft.SemanticKernel.Abstractions.dll</Right>
44+
<IsBaselineSuppression>true</IsBaselineSuppression>
45+
</Suppression>
46+
<Suppression>
47+
<DiagnosticId>CP0002</DiagnosticId>
48+
<Target>M:Microsoft.SemanticKernel.KernelParameterMetadata.set_DefaultValue(System.Object)</Target>
49+
<Left>lib/net8.0/Microsoft.SemanticKernel.Abstractions.dll</Left>
50+
<Right>lib/net8.0/Microsoft.SemanticKernel.Abstractions.dll</Right>
51+
<IsBaselineSuppression>true</IsBaselineSuppression>
52+
</Suppression>
53+
<Suppression>
54+
<DiagnosticId>CP0002</DiagnosticId>
55+
<Target>M:Microsoft.SemanticKernel.KernelParameterMetadata.set_Description(System.String)</Target>
56+
<Left>lib/net8.0/Microsoft.SemanticKernel.Abstractions.dll</Left>
57+
<Right>lib/net8.0/Microsoft.SemanticKernel.Abstractions.dll</Right>
58+
<IsBaselineSuppression>true</IsBaselineSuppression>
59+
</Suppression>
60+
<Suppression>
61+
<DiagnosticId>CP0002</DiagnosticId>
62+
<Target>M:Microsoft.SemanticKernel.KernelParameterMetadata.set_IsRequired(System.Boolean)</Target>
63+
<Left>lib/net8.0/Microsoft.SemanticKernel.Abstractions.dll</Left>
64+
<Right>lib/net8.0/Microsoft.SemanticKernel.Abstractions.dll</Right>
65+
<IsBaselineSuppression>true</IsBaselineSuppression>
66+
</Suppression>
67+
<Suppression>
68+
<DiagnosticId>CP0002</DiagnosticId>
69+
<Target>M:Microsoft.SemanticKernel.KernelParameterMetadata.set_Name(System.String)</Target>
70+
<Left>lib/net8.0/Microsoft.SemanticKernel.Abstractions.dll</Left>
71+
<Right>lib/net8.0/Microsoft.SemanticKernel.Abstractions.dll</Right>
72+
<IsBaselineSuppression>true</IsBaselineSuppression>
73+
</Suppression>
74+
<Suppression>
75+
<DiagnosticId>CP0002</DiagnosticId>
76+
<Target>M:Microsoft.SemanticKernel.KernelParameterMetadata.set_ParameterType(System.Type)</Target>
77+
<Left>lib/net8.0/Microsoft.SemanticKernel.Abstractions.dll</Left>
78+
<Right>lib/net8.0/Microsoft.SemanticKernel.Abstractions.dll</Right>
79+
<IsBaselineSuppression>true</IsBaselineSuppression>
80+
</Suppression>
81+
<Suppression>
82+
<DiagnosticId>CP0002</DiagnosticId>
83+
<Target>M:Microsoft.SemanticKernel.KernelParameterMetadata.set_Schema(Microsoft.SemanticKernel.KernelJsonSchema)</Target>
84+
<Left>lib/net8.0/Microsoft.SemanticKernel.Abstractions.dll</Left>
85+
<Right>lib/net8.0/Microsoft.SemanticKernel.Abstractions.dll</Right>
86+
<IsBaselineSuppression>true</IsBaselineSuppression>
87+
</Suppression>
88+
<Suppression>
89+
<DiagnosticId>CP0002</DiagnosticId>
90+
<Target>M:Microsoft.SemanticKernel.KernelReturnParameterMetadata.set_Description(System.String)</Target>
91+
<Left>lib/net8.0/Microsoft.SemanticKernel.Abstractions.dll</Left>
92+
<Right>lib/net8.0/Microsoft.SemanticKernel.Abstractions.dll</Right>
93+
<IsBaselineSuppression>true</IsBaselineSuppression>
94+
</Suppression>
95+
<Suppression>
96+
<DiagnosticId>CP0002</DiagnosticId>
97+
<Target>M:Microsoft.SemanticKernel.KernelReturnParameterMetadata.set_ParameterType(System.Type)</Target>
98+
<Left>lib/net8.0/Microsoft.SemanticKernel.Abstractions.dll</Left>
99+
<Right>lib/net8.0/Microsoft.SemanticKernel.Abstractions.dll</Right>
100+
<IsBaselineSuppression>true</IsBaselineSuppression>
101+
</Suppression>
102+
<Suppression>
103+
<DiagnosticId>CP0002</DiagnosticId>
104+
<Target>M:Microsoft.SemanticKernel.KernelReturnParameterMetadata.set_Schema(Microsoft.SemanticKernel.KernelJsonSchema)</Target>
105+
<Left>lib/net8.0/Microsoft.SemanticKernel.Abstractions.dll</Left>
106+
<Right>lib/net8.0/Microsoft.SemanticKernel.Abstractions.dll</Right>
107+
<IsBaselineSuppression>true</IsBaselineSuppression>
108+
</Suppression>
109+
<Suppression>
110+
<DiagnosticId>CP0002</DiagnosticId>
111+
<Target>M:Microsoft.SemanticKernel.KernelFunctionMetadata.set_AdditionalProperties(System.Collections.ObjectModel.ReadOnlyDictionary{System.String,System.Object})</Target>
112+
<Left>lib/netstandard2.0/Microsoft.SemanticKernel.Abstractions.dll</Left>
113+
<Right>lib/netstandard2.0/Microsoft.SemanticKernel.Abstractions.dll</Right>
114+
<IsBaselineSuppression>true</IsBaselineSuppression>
115+
</Suppression>
116+
<Suppression>
117+
<DiagnosticId>CP0002</DiagnosticId>
118+
<Target>M:Microsoft.SemanticKernel.KernelFunctionMetadata.set_Description(System.String)</Target>
119+
<Left>lib/netstandard2.0/Microsoft.SemanticKernel.Abstractions.dll</Left>
120+
<Right>lib/netstandard2.0/Microsoft.SemanticKernel.Abstractions.dll</Right>
121+
<IsBaselineSuppression>true</IsBaselineSuppression>
122+
</Suppression>
123+
<Suppression>
124+
<DiagnosticId>CP0002</DiagnosticId>
125+
<Target>M:Microsoft.SemanticKernel.KernelFunctionMetadata.set_Name(System.String)</Target>
126+
<Left>lib/netstandard2.0/Microsoft.SemanticKernel.Abstractions.dll</Left>
127+
<Right>lib/netstandard2.0/Microsoft.SemanticKernel.Abstractions.dll</Right>
128+
<IsBaselineSuppression>true</IsBaselineSuppression>
129+
</Suppression>
130+
<Suppression>
131+
<DiagnosticId>CP0002</DiagnosticId>
132+
<Target>M:Microsoft.SemanticKernel.KernelFunctionMetadata.set_Parameters(System.Collections.Generic.IReadOnlyList{Microsoft.SemanticKernel.KernelParameterMetadata})</Target>
133+
<Left>lib/netstandard2.0/Microsoft.SemanticKernel.Abstractions.dll</Left>
134+
<Right>lib/netstandard2.0/Microsoft.SemanticKernel.Abstractions.dll</Right>
135+
<IsBaselineSuppression>true</IsBaselineSuppression>
136+
</Suppression>
137+
<Suppression>
138+
<DiagnosticId>CP0002</DiagnosticId>
139+
<Target>M:Microsoft.SemanticKernel.KernelFunctionMetadata.set_PluginName(System.String)</Target>
140+
<Left>lib/netstandard2.0/Microsoft.SemanticKernel.Abstractions.dll</Left>
141+
<Right>lib/netstandard2.0/Microsoft.SemanticKernel.Abstractions.dll</Right>
142+
<IsBaselineSuppression>true</IsBaselineSuppression>
143+
</Suppression>
144+
<Suppression>
145+
<DiagnosticId>CP0002</DiagnosticId>
146+
<Target>M:Microsoft.SemanticKernel.KernelFunctionMetadata.set_ReturnParameter(Microsoft.SemanticKernel.KernelReturnParameterMetadata)</Target>
147+
<Left>lib/netstandard2.0/Microsoft.SemanticKernel.Abstractions.dll</Left>
148+
<Right>lib/netstandard2.0/Microsoft.SemanticKernel.Abstractions.dll</Right>
149+
<IsBaselineSuppression>true</IsBaselineSuppression>
150+
</Suppression>
151+
<Suppression>
152+
<DiagnosticId>CP0002</DiagnosticId>
153+
<Target>M:Microsoft.SemanticKernel.KernelParameterMetadata.set_DefaultValue(System.Object)</Target>
154+
<Left>lib/netstandard2.0/Microsoft.SemanticKernel.Abstractions.dll</Left>
155+
<Right>lib/netstandard2.0/Microsoft.SemanticKernel.Abstractions.dll</Right>
156+
<IsBaselineSuppression>true</IsBaselineSuppression>
157+
</Suppression>
158+
<Suppression>
159+
<DiagnosticId>CP0002</DiagnosticId>
160+
<Target>M:Microsoft.SemanticKernel.KernelParameterMetadata.set_Description(System.String)</Target>
161+
<Left>lib/netstandard2.0/Microsoft.SemanticKernel.Abstractions.dll</Left>
162+
<Right>lib/netstandard2.0/Microsoft.SemanticKernel.Abstractions.dll</Right>
163+
<IsBaselineSuppression>true</IsBaselineSuppression>
164+
</Suppression>
165+
<Suppression>
166+
<DiagnosticId>CP0002</DiagnosticId>
167+
<Target>M:Microsoft.SemanticKernel.KernelParameterMetadata.set_IsRequired(System.Boolean)</Target>
168+
<Left>lib/netstandard2.0/Microsoft.SemanticKernel.Abstractions.dll</Left>
169+
<Right>lib/netstandard2.0/Microsoft.SemanticKernel.Abstractions.dll</Right>
170+
<IsBaselineSuppression>true</IsBaselineSuppression>
171+
</Suppression>
172+
<Suppression>
173+
<DiagnosticId>CP0002</DiagnosticId>
174+
<Target>M:Microsoft.SemanticKernel.KernelParameterMetadata.set_Name(System.String)</Target>
175+
<Left>lib/netstandard2.0/Microsoft.SemanticKernel.Abstractions.dll</Left>
176+
<Right>lib/netstandard2.0/Microsoft.SemanticKernel.Abstractions.dll</Right>
177+
<IsBaselineSuppression>true</IsBaselineSuppression>
178+
</Suppression>
179+
<Suppression>
180+
<DiagnosticId>CP0002</DiagnosticId>
181+
<Target>M:Microsoft.SemanticKernel.KernelParameterMetadata.set_ParameterType(System.Type)</Target>
182+
<Left>lib/netstandard2.0/Microsoft.SemanticKernel.Abstractions.dll</Left>
183+
<Right>lib/netstandard2.0/Microsoft.SemanticKernel.Abstractions.dll</Right>
184+
<IsBaselineSuppression>true</IsBaselineSuppression>
185+
</Suppression>
186+
<Suppression>
187+
<DiagnosticId>CP0002</DiagnosticId>
188+
<Target>M:Microsoft.SemanticKernel.KernelParameterMetadata.set_Schema(Microsoft.SemanticKernel.KernelJsonSchema)</Target>
189+
<Left>lib/netstandard2.0/Microsoft.SemanticKernel.Abstractions.dll</Left>
190+
<Right>lib/netstandard2.0/Microsoft.SemanticKernel.Abstractions.dll</Right>
191+
<IsBaselineSuppression>true</IsBaselineSuppression>
192+
</Suppression>
193+
<Suppression>
194+
<DiagnosticId>CP0002</DiagnosticId>
195+
<Target>M:Microsoft.SemanticKernel.KernelReturnParameterMetadata.set_Description(System.String)</Target>
196+
<Left>lib/netstandard2.0/Microsoft.SemanticKernel.Abstractions.dll</Left>
197+
<Right>lib/netstandard2.0/Microsoft.SemanticKernel.Abstractions.dll</Right>
198+
<IsBaselineSuppression>true</IsBaselineSuppression>
199+
</Suppression>
200+
<Suppression>
201+
<DiagnosticId>CP0002</DiagnosticId>
202+
<Target>M:Microsoft.SemanticKernel.KernelReturnParameterMetadata.set_ParameterType(System.Type)</Target>
203+
<Left>lib/netstandard2.0/Microsoft.SemanticKernel.Abstractions.dll</Left>
204+
<Right>lib/netstandard2.0/Microsoft.SemanticKernel.Abstractions.dll</Right>
205+
<IsBaselineSuppression>true</IsBaselineSuppression>
206+
</Suppression>
207+
<Suppression>
208+
<DiagnosticId>CP0002</DiagnosticId>
209+
<Target>M:Microsoft.SemanticKernel.KernelReturnParameterMetadata.set_Schema(Microsoft.SemanticKernel.KernelJsonSchema)</Target>
210+
<Left>lib/netstandard2.0/Microsoft.SemanticKernel.Abstractions.dll</Left>
211+
<Right>lib/netstandard2.0/Microsoft.SemanticKernel.Abstractions.dll</Right>
212+
<IsBaselineSuppression>true</IsBaselineSuppression>
213+
</Suppression>
214+
</Suppressions>

dotnet/src/SemanticKernel.Abstractions/Functions/KernelFunctionMetadata.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public KernelFunctionMetadata(KernelFunctionMetadata metadata)
5555
public string Name
5656
{
5757
get => this._name;
58-
init
58+
set
5959
{
6060
Verify.NotNull(value);
6161
KernelVerify.ValidFunctionName(value);
@@ -64,22 +64,22 @@ public string Name
6464
}
6565

6666
/// <summary>Gets the name of the plugin containing the function.</summary>
67-
public string? PluginName { get; init; }
67+
public string? PluginName { get; set; }
6868

6969
/// <summary>Gets a description of the function, suitable for use in describing the purpose to a model.</summary>
7070
[AllowNull]
7171
public string Description
7272
{
7373
get => this._description;
74-
init => this._description = value ?? string.Empty;
74+
set => this._description = value ?? string.Empty;
7575
}
7676

7777
/// <summary>Gets the metadata for the parameters to the function.</summary>
7878
/// <remarks>If the function has no parameters, the returned list will be empty.</remarks>
7979
public IReadOnlyList<KernelParameterMetadata> Parameters
8080
{
8181
get => this._parameters;
82-
init
82+
set
8383
{
8484
Verify.NotNull(value);
8585
this._parameters = value;
@@ -91,7 +91,7 @@ public IReadOnlyList<KernelParameterMetadata> Parameters
9191
public KernelReturnParameterMetadata ReturnParameter
9292
{
9393
get => this._returnParameter ??= KernelReturnParameterMetadata.Empty;
94-
init
94+
set
9595
{
9696
Verify.NotNull(value);
9797
this._returnParameter = value;
@@ -102,7 +102,7 @@ public KernelReturnParameterMetadata ReturnParameter
102102
public ReadOnlyDictionary<string, object?> AdditionalProperties
103103
{
104104
get => this._additionalProperties ??= s_emptyDictionary;
105-
init
105+
set
106106
{
107107
Verify.NotNull(value);
108108
this._additionalProperties = value;

dotnet/src/SemanticKernel.Abstractions/Functions/KernelParameterMetadata.cs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ public sealed class KernelParameterMetadata
3131
/// <exception cref="ArgumentException">The <paramref name="name"/> was empty or composed entirely of whitespace.</exception>
3232
[RequiresUnreferencedCode("Uses reflection to generate schema, making it incompatible with AOT scenarios.")]
3333
[RequiresDynamicCode("Uses reflection to generate schema, making it incompatible with AOT scenarios.")]
34-
public KernelParameterMetadata(string name) => this.Name = name;
34+
public KernelParameterMetadata(string name)
35+
: this(name, null!)
36+
{ }
3537

3638
/// <summary>Initializes the <see cref="KernelParameterMetadata"/> for a parameter with the specified name.</summary>
3739
/// <param name="name">The name of the parameter.</param>
@@ -82,7 +84,7 @@ public KernelParameterMetadata(KernelParameterMetadata metadata, JsonSerializerO
8284
public string Name
8385
{
8486
get => this._name;
85-
init
87+
set
8688
{
8789
Verify.NotNullOrWhiteSpace(value);
8890
this._name = value;
@@ -94,7 +96,7 @@ public string Name
9496
public string Description
9597
{
9698
get => this._description;
97-
init
99+
set
98100
{
99101
string newDescription = value ?? string.Empty;
100102
if (value != this._description && this._schema?.Inferred is true)
@@ -109,7 +111,7 @@ public string Description
109111
public object? DefaultValue
110112
{
111113
get => this._defaultValue;
112-
init
114+
set
113115
{
114116
if (value != this._defaultValue && this._schema?.Inferred is true)
115117
{
@@ -120,14 +122,14 @@ public object? DefaultValue
120122
}
121123

122124
/// <summary>Gets whether the parameter is required.</summary>
123-
public bool IsRequired { get; init; }
125+
public bool IsRequired { get; set; }
124126

125127
/// <summary>Gets the .NET type of the parameter.</summary>
126128
[JsonIgnore]
127129
public Type? ParameterType
128130
{
129131
get => this._parameterType;
130-
init
132+
set
131133
{
132134
if (value != this._parameterType && this._schema?.Inferred is true)
133135
{
@@ -143,7 +145,7 @@ public KernelJsonSchema? Schema
143145
[UnconditionalSuppressMessage("Trimming", "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", Justification = "The warning is shown and should be addressed at the class creation site; no need to show it again at the members invocation sites.")]
144146
[UnconditionalSuppressMessage("AOT", "IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.", Justification = "The warning is shown and should be addressed at the class creation site; no need to show it again at the members invocation sites.")]
145147
get => (this._schema ??= InferSchema(this.ParameterType, this.DefaultValue, this.Description, this._jsonSerializerOptions)).Schema;
146-
init => this._schema = value is null ? null : new() { Inferred = false, Schema = value };
148+
set => this._schema = value is null ? null : new() { Inferred = false, Schema = value };
147149
}
148150

149151
/// <summary>Infers a JSON schema from a <see cref="Type"/> and description.</summary>

dotnet/src/SemanticKernel.Abstractions/Functions/KernelReturnParameterMetadata.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public KernelReturnParameterMetadata(KernelReturnParameterMetadata metadata, Jso
7272
public string Description
7373
{
7474
get => this._description;
75-
init
75+
set
7676
{
7777
string newDescription = value ?? string.Empty;
7878
if (value != this._description && this._schema?.Inferred is true)
@@ -87,7 +87,7 @@ public string Description
8787
public Type? ParameterType
8888
{
8989
get => this._parameterType;
90-
init
90+
set
9191
{
9292
if (value != this._parameterType && this._schema?.Inferred is true)
9393
{
@@ -103,6 +103,6 @@ public KernelJsonSchema? Schema
103103
[UnconditionalSuppressMessage("Trimming", "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", Justification = "The warning is shown and should be addressed at the class creation site; no need to show it again at the members invocation sites.")]
104104
[UnconditionalSuppressMessage("AOT", "IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.", Justification = "The warning is shown and should be addressed at the class creation site; no need to show it again at the members invocation sites.")]
105105
get => (this._schema ??= InferSchema(this.ParameterType, defaultValue: null, this.Description, this._jsonSerializerOptions)).Schema;
106-
init => this._schema = value is null ? null : new() { Inferred = false, Schema = value };
106+
set => this._schema = value is null ? null : new() { Inferred = false, Schema = value };
107107
}
108108
}

0 commit comments

Comments
 (0)