Skip to content

Commit 2347470

Browse files
authored
Use new mrw overloads (#5297)
* update to use new mrw overloads * regen after changes * regen after merge * pull in new version and shared source * temp use alternate branch * missed one branch * bump to latest * bump version and regen * bump version of scm and ac * bump versions to ga * regen after update * upgrade to 9/8/462 for test projects * regen after spec update * make conditional more clear
1 parent 6ce4820 commit 2347470

File tree

1,862 files changed

+10251
-3235
lines changed

Some content is hidden

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

1,862 files changed

+10251
-3235
lines changed

Directory.Build.props

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
<NoWarn Condition="'$(IsUnbranded)' == 'true'">AZC0107</NoWarn>
2424
<NoWarn Condition="'$(IsNoDocProject)' == 'true'">$(NoWarn);CS1591</NoWarn>
2525
<NoWarn Condition="'$(IsTestGenerationSampleProject)' == 'true'">$(NoWarn);CS1591</NoWarn>
26+
<!-- Since Resource classes implement IPersistableModel and don't have a public or internal parameterless ctor we need to suppress this -->
27+
<!-- We should consider fixing this in the future for more info see https://aka.ms/system-clientmodel/diagnostics#scm0005 -->
28+
<NoWarn Condition="'$(IsMgmtLibrary)' == 'true'">$(NoWarn);SCM0005</NoWarn>
2629
<IncludeSharedSourceInLocalBuild Condition="!$(MSBuildProjectName.StartsWith('AutoRest.')) And '$(IsTestGenerationTestProject)' != 'true'">true</IncludeSharedSourceInLocalBuild>
2730
</PropertyGroup>
2831

Directory.Build.targets

Lines changed: 303 additions & 0 deletions
Large diffs are not rendered by default.

Packages.Data.props

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,37 +21,38 @@
2121

2222
<ItemGroup Condition="$(MSBuildProjectName.EndsWith('.Tests'))">
2323
<PackageReference Update="Azure.Identity" Version="1.11.4" />
24-
<PackageReference Update="NUnit3TestAdapter" Version="4.4.2" />
2524
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="17.0.0" />
25+
<PackageReference Update="NUnit3TestAdapter" Version="4.4.2" />
2626
</ItemGroup>
2727

2828
<!-- Library only dependencies. -->
2929
<ItemGroup Condition="'$(IsTestGenerationSrcProject)' == 'true'">
3030
<PackageReference Update="System.Text.Json" Version="4.7.2" />
3131

3232
<!-- Include analyzers so that we see issues in this repo before we do a regen preview-->
33-
<PackageReference Update="Azure.ClientSdk.Analyzers" Version="0.1.1-dev.20240813.2" PrivateAssets="All" />
34-
<PackageReference Update="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0" PrivateAssets="All" />
33+
<PackageReference Update="Azure.ClientSdk.Analyzers" Version="0.1.1-dev.20250422.1" PrivateAssets="All" />
3534
<PackageReference Update="Microsoft.CodeAnalysis.BannedApiAnalyzers" Version="3.3.2" PrivateAssets="All" />
35+
<PackageReference Update="Microsoft.CodeAnalysis.NetAnalyzers" Version="9.0.0" PrivateAssets="All" />
3636
</ItemGroup>
3737

3838
<!-- All csproj dependencies. -->
3939
<ItemGroup>
40-
<PackageReference Update="NUnit" Version="3.13.2" />
41-
<PackageReference Update="System.ClientModel" Version="1.1.0-beta.3" />
42-
<PackageReference Update="Azure.Core" Version="1.42.0" />
40+
<PackageReference Update="Azure.Core" Version="1.46.0" />
4341
<PackageReference Update="Azure.Core.Experimental" Version="0.1.0-preview.18" />
44-
<PackageReference Update="Azure.ResourceManager" Version="1.13.0" />
4542
<PackageReference Update="Azure.Core.Expressions.DataFactory" Version="1.0.0" />
46-
<PackageReference Update="Microsoft.AspNetCore.Server.Kestrel" Version="2.2.0" />
47-
<PackageReference Update="System.Diagnostics.DiagnosticSource" Version="6.0.1" />
43+
<PackageReference Update="Azure.ResourceManager" Version="1.13.0" />
4844
<PackageReference Update="CommandLineParser" Version="2.9.1" />
4945
<PackageReference Update="Humanizer.Core" Version="2.13.14" />
46+
<PackageReference Update="Microsoft.AspNetCore.Server.Kestrel" Version="2.2.0" />
47+
<PackageReference Update="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" />
48+
<PackageReference Update="Microsoft.Build" Version="16.11.0" />
5049
<PackageReference Update="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.1.0" />
51-
<PackageReference Update="System.Text.Json" Version="6.0.10" />
52-
<PackageReference Update="YamlDotNet" Version="11.2.1" />
53-
<PackageReference Update="System.Memory" Version="4.5.4" />
5450
<PackageReference Update="NuGet.Configuration" Version="6.8.0" />
55-
<PackageReference Update="Microsoft.Build" Version="16.11.0" />
51+
<PackageReference Update="NUnit" Version="3.13.2" />
52+
<PackageReference Update="System.ClientModel" Version="1.4.0" />
53+
<PackageReference Update="System.Diagnostics.DiagnosticSource" Version="8.0.0" />
54+
<PackageReference Update="System.Memory" Version="4.5.4" />
55+
<PackageReference Update="System.Text.Json" Version="8.0.5" />
56+
<PackageReference Update="YamlDotNet" Version="11.2.1" />
5657
</ItemGroup>
5758
</Project>

samples/AnomalyDetector/src/AnomalyDetector.csproj

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

samples/AnomalyDetector/src/Generated/Internal/ModelSerializationExtensions.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ internal static class ModelSerializationExtensions
2020
{
2121
internal static readonly JsonDocumentOptions JsonDocumentOptions = new JsonDocumentOptions { MaxDepth = 256 };
2222
internal static readonly ModelReaderWriterOptions WireOptions = new ModelReaderWriterOptions("W");
23+
internal static readonly BinaryData SentinelValue = BinaryData.FromBytes("\"__EMPTY__\""u8.ToArray());
2324

2425
public static object GetObject(this JsonElement element)
2526
{
@@ -257,6 +258,13 @@ public static void WriteObjectValue(this Utf8JsonWriter writer, object value, Mo
257258
writer.WriteObjectValue<object>(value, options);
258259
}
259260

261+
internal static bool IsSentinelValue(BinaryData value)
262+
{
263+
ReadOnlySpan<byte> sentinelSpan = SentinelValue.ToMemory().Span;
264+
ReadOnlySpan<byte> valueSpan = value.ToMemory().Span;
265+
return sentinelSpan.SequenceEqual(valueSpan);
266+
}
267+
260268
internal static class TypeFormatters
261269
{
262270
private const string RoundtripZFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ";

samples/AnomalyDetector/src/Generated/Models/AlignPolicy.Serialization.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ BinaryData IPersistableModel<AlignPolicy>.Write(ModelReaderWriterOptions options
137137
switch (format)
138138
{
139139
case "J":
140-
return ModelReaderWriter.Write(this, options);
140+
return ModelReaderWriter.Write(this, options, AnomalyDetectorContext.Default);
141141
default:
142142
throw new FormatException($"The model {nameof(AlignPolicy)} does not support writing '{options.Format}' format.");
143143
}

samples/AnomalyDetector/src/Generated/Models/AnomalyDetectionModel.Serialization.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ BinaryData IPersistableModel<AnomalyDetectionModel>.Write(ModelReaderWriterOptio
134134
switch (format)
135135
{
136136
case "J":
137-
return ModelReaderWriter.Write(this, options);
137+
return ModelReaderWriter.Write(this, options, AnomalyDetectorContext.Default);
138138
default:
139139
throw new FormatException($"The model {nameof(AnomalyDetectionModel)} does not support writing '{options.Format}' format.");
140140
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
// <auto-generated/>
5+
6+
#nullable disable
7+
8+
using System.ClientModel.Primitives;
9+
10+
namespace AnomalyDetector
11+
{
12+
/// <summary>
13+
/// Context class which will be filled in by the System.ClientModel.SourceGeneration.
14+
/// For more information see 'https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/System.ClientModel/src/docs/ModelReaderWriterContext.md'
15+
/// </summary>
16+
public partial class AnomalyDetectorContext : ModelReaderWriterContext
17+
{
18+
}
19+
}

samples/AnomalyDetector/src/Generated/Models/AnomalyInterpretation.Serialization.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ BinaryData IPersistableModel<AnomalyInterpretation>.Write(ModelReaderWriterOptio
133133
switch (format)
134134
{
135135
case "J":
136-
return ModelReaderWriter.Write(this, options);
136+
return ModelReaderWriter.Write(this, options, AnomalyDetectorContext.Default);
137137
default:
138138
throw new FormatException($"The model {nameof(AnomalyInterpretation)} does not support writing '{options.Format}' format.");
139139
}

samples/AnomalyDetector/src/Generated/Models/AnomalyState.Serialization.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ BinaryData IPersistableModel<AnomalyState>.Write(ModelReaderWriterOptions option
140140
switch (format)
141141
{
142142
case "J":
143-
return ModelReaderWriter.Write(this, options);
143+
return ModelReaderWriter.Write(this, options, AnomalyDetectorContext.Default);
144144
default:
145145
throw new FormatException($"The model {nameof(AnomalyState)} does not support writing '{options.Format}' format.");
146146
}

0 commit comments

Comments
 (0)