Skip to content
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
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
8 changes: 4 additions & 4 deletions eng/Packages.Data.props
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@

<!-- BCL packages -->
<PackageReference Update="System.Buffers" Version="4.5.1" />
<PackageReference Update="System.ClientModel" Version="1.3.0" />
<PackageReference Update="System.ClientModel" Version="1.4.0" />
<PackageReference Update="System.IO.Hashing" Version="8.0.0" />
<PackageReference Update="System.Memory" Version="4.5.5" />
<PackageReference Update="System.Memory.Data" Version="6.0.1" />
Expand Down Expand Up @@ -209,7 +209,7 @@
<PackageReference Update="Microsoft.TypeSpec.Generator.ClientModel" Version="1.0.0-alpha.20250501.3" />
<PackageReference Update="Microsoft.TypeSpec.Generator.Input" Version="1.0.0-alpha.20250501.3" />
<PackageReference Update="Azure.Generator" Version="1.0.0-alpha.20250429.2" />
<PackageReference Update="System.ClientModel" Version="1.3.0" />
<PackageReference Update="System.ClientModel" Version="1.4.0" />
</ItemGroup>

<!--
Expand Down Expand Up @@ -278,7 +278,7 @@
-->
<ItemGroup>
<PackageReference Update="Microsoft.Azure.AutoRest.CSharp" Version="3.0.0-beta.20250430.1" PrivateAssets="All" />
<PackageReference Update="Azure.ClientSdk.Analyzers" Version="0.1.1-dev.20250310.1" PrivateAssets="All" />
<PackageReference Update="Azure.ClientSdk.Analyzers" Version="0.1.1-dev.20250422.1" PrivateAssets="All" />
<PackageReference Update="coverlet.collector" Version="3.2.0" PrivateAssets="All" />
<!-- Note: Upgrading the .NET SDK version needs to be synchronized with the autorest.csharp repository -->
<PackageReference Update="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0" PrivateAssets="All"/>
Expand Down Expand Up @@ -411,7 +411,7 @@
<PackageReference Update="Polly.Contrib.WaitAndRetry" Version="1.1.1" />
<PackageReference Update="Portable.BouncyCastle" Version="1.9.0" />
<PackageReference Update="PublicApiGenerator" Version="10.0.1" />
<PackageReference Update="System.ClientModel" Version="1.3.0" />
<PackageReference Update="System.ClientModel" Version="1.4.0" />
<PackageReference Update="System.Diagnostics.TraceSource" Version="4.3.0" />
<PackageReference Update="System.IO.Compression" Version="4.3.0" />
<PackageReference Update="System.IO.Pipelines" Version="4.5.1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Azure.Core" />
<ProjectReference Include="..\..\Azure.Core\src\Azure.Core.csproj" />
<PackageReference Include="Microsoft.CSharp" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<IncludeOperationsSharedSource>true</IncludeOperationsSharedSource>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Azure.Core" />
<ProjectReference Include="..\..\Azure.Core\src\Azure.Core.csproj" />
<PackageReference Include="Azure.Identity" />
<PackageReference Include="Newtonsoft.Json" />
<PackageReference Include="NUnit" />
Expand Down
6 changes: 6 additions & 0 deletions sdk/core/Azure.Core/api/Azure.Core.net462.cs
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,12 @@ public partial struct AccessToken
public override bool Equals(object? obj) { throw null; }
public override int GetHashCode() { throw null; }
}
public partial class AzureCoreContext : System.ClientModel.Primitives.ModelReaderWriterContext
{
internal AzureCoreContext() { }
public static Azure.Core.AzureCoreContext Default { get { throw null; } }
protected override bool TryGetTypeBuilderCore(System.Type type, out System.ClientModel.Primitives.ModelReaderWriterTypeBuilder builder) { throw null; }
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public readonly partial struct AzureLocation : System.IEquatable<Azure.Core.AzureLocation>
{
Expand Down
6 changes: 6 additions & 0 deletions sdk/core/Azure.Core/api/Azure.Core.net472.cs
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,12 @@ public partial struct AccessToken
public override bool Equals(object? obj) { throw null; }
public override int GetHashCode() { throw null; }
}
public partial class AzureCoreContext : System.ClientModel.Primitives.ModelReaderWriterContext
{
internal AzureCoreContext() { }
public static Azure.Core.AzureCoreContext Default { get { throw null; } }
protected override bool TryGetTypeBuilderCore(System.Type type, out System.ClientModel.Primitives.ModelReaderWriterTypeBuilder builder) { throw null; }
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public readonly partial struct AzureLocation : System.IEquatable<Azure.Core.AzureLocation>
{
Expand Down
6 changes: 6 additions & 0 deletions sdk/core/Azure.Core/api/Azure.Core.net6.0.cs
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,12 @@ public partial struct AccessToken
public override bool Equals(object? obj) { throw null; }
public override int GetHashCode() { throw null; }
}
public partial class AzureCoreContext : System.ClientModel.Primitives.ModelReaderWriterContext
{
internal AzureCoreContext() { }
public static Azure.Core.AzureCoreContext Default { get { throw null; } }
protected override bool TryGetTypeBuilderCore(System.Type type, out System.ClientModel.Primitives.ModelReaderWriterTypeBuilder builder) { throw null; }
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public readonly partial struct AzureLocation : System.IEquatable<Azure.Core.AzureLocation>
{
Expand Down
6 changes: 6 additions & 0 deletions sdk/core/Azure.Core/api/Azure.Core.net8.0.cs
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,12 @@ public partial struct AccessToken
public override bool Equals(object? obj) { throw null; }
public override int GetHashCode() { throw null; }
}
public partial class AzureCoreContext : System.ClientModel.Primitives.ModelReaderWriterContext
{
internal AzureCoreContext() { }
public static Azure.Core.AzureCoreContext Default { get { throw null; } }
protected override bool TryGetTypeBuilderCore(System.Type type, out System.ClientModel.Primitives.ModelReaderWriterTypeBuilder builder) { throw null; }
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public readonly partial struct AzureLocation : System.IEquatable<Azure.Core.AzureLocation>
{
Expand Down
6 changes: 6 additions & 0 deletions sdk/core/Azure.Core/api/Azure.Core.netstandard2.0.cs
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,12 @@ public partial struct AccessToken
public override bool Equals(object? obj) { throw null; }
public override int GetHashCode() { throw null; }
}
public partial class AzureCoreContext : System.ClientModel.Primitives.ModelReaderWriterContext
{
internal AzureCoreContext() { }
public static Azure.Core.AzureCoreContext Default { get { throw null; } }
protected override bool TryGetTypeBuilderCore(System.Type type, out System.ClientModel.Primitives.ModelReaderWriterTypeBuilder builder) { throw null; }
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public readonly partial struct AzureLocation : System.IEquatable<Azure.Core.AzureLocation>
{
Expand Down
14 changes: 14 additions & 0 deletions sdk/core/Azure.Core/src/AzureCoreContext.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System.ClientModel.Primitives;

namespace Azure.Core
{
/// <summary>
/// Context class used by <see cref="ModelReaderWriter"/> to read and write models in an AOT compatible way.
/// </summary>
public partial class AzureCoreContext : ModelReaderWriterContext
{
}
}
3 changes: 3 additions & 0 deletions sdk/core/Azure.Core/src/Internal/GenericOperationSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ ValueTask<T> IOperationSource<T>.CreateResultAsync(Response response, Cancellati
=> new ValueTask<T>(CreateResult(response));

private T CreateResult(Response response)
//TODO: Will add an AOT compatible overload during https://github.com/Azure/azure-sdk-for-net/issues/48294
#pragma warning disable AZC0150 // Use ModelReaderWriter overloads with ModelReaderWriterContext
=> ModelReaderWriter.Read<T>(response.Content)!;
#pragma warning restore AZC0150 // Use ModelReaderWriter overloads with ModelReaderWriterContext
}
}
2 changes: 1 addition & 1 deletion sdk/core/Azure.Core/src/RehydrationToken.Serialization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
switch (format)
{
case "J":
return ModelReaderWriter.Write(this, options);
return ModelReaderWriter.Write(this, options, AzureCoreContext.Default);

Check failure on line 143 in sdk/core/Azure.Core/src/RehydrationToken.Serialization.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release)

sdk/core/Azure.Core/src/RehydrationToken.Serialization.cs#L143

sdk/core/Azure.Core/src/RehydrationToken.Serialization.cs(143,84): Error CS0117: 'AzureCoreContext' does not contain a definition for 'Default'

Check failure on line 143 in sdk/core/Azure.Core/src/RehydrationToken.Serialization.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib19)

sdk/core/Azure.Core/src/RehydrationToken.Serialization.cs#L143

sdk/core/Azure.Core/src/RehydrationToken.Serialization.cs(143,84): Error CS0117: 'AzureCoreContext' does not contain a definition for 'Default'

Check failure on line 143 in sdk/core/Azure.Core/src/RehydrationToken.Serialization.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test MacOS_NET90_ProjectRef_Release)

sdk/core/Azure.Core/src/RehydrationToken.Serialization.cs#L143

sdk/core/Azure.Core/src/RehydrationToken.Serialization.cs(143,84): Error CS0117: 'AzureCoreContext' does not contain a definition for 'Default'

Check failure on line 143 in sdk/core/Azure.Core/src/RehydrationToken.Serialization.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib2)

sdk/core/Azure.Core/src/RehydrationToken.Serialization.cs#L143

sdk/core/Azure.Core/src/RehydrationToken.Serialization.cs(143,84): Error CS0117: 'AzureCoreContext' does not contain a definition for 'Default'

Check failure on line 143 in sdk/core/Azure.Core/src/RehydrationToken.Serialization.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib3)

sdk/core/Azure.Core/src/RehydrationToken.Serialization.cs#L143

sdk/core/Azure.Core/src/RehydrationToken.Serialization.cs(143,84): Error CS0117: 'AzureCoreContext' does not contain a definition for 'Default'

Check failure on line 143 in sdk/core/Azure.Core/src/RehydrationToken.Serialization.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib1)

sdk/core/Azure.Core/src/RehydrationToken.Serialization.cs#L143

sdk/core/Azure.Core/src/RehydrationToken.Serialization.cs(143,84): Error CS0117: 'AzureCoreContext' does not contain a definition for 'Default'

Check failure on line 143 in sdk/core/Azure.Core/src/RehydrationToken.Serialization.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib4)

sdk/core/Azure.Core/src/RehydrationToken.Serialization.cs#L143

sdk/core/Azure.Core/src/RehydrationToken.Serialization.cs(143,84): Error CS0117: 'AzureCoreContext' does not contain a definition for 'Default'

Check failure on line 143 in sdk/core/Azure.Core/src/RehydrationToken.Serialization.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib18)

sdk/core/Azure.Core/src/RehydrationToken.Serialization.cs#L143

sdk/core/Azure.Core/src/RehydrationToken.Serialization.cs(143,84): Error CS0117: 'AzureCoreContext' does not contain a definition for 'Default'

Check failure on line 143 in sdk/core/Azure.Core/src/RehydrationToken.Serialization.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib5)

sdk/core/Azure.Core/src/RehydrationToken.Serialization.cs#L143

sdk/core/Azure.Core/src/RehydrationToken.Serialization.cs(143,84): Error CS0117: 'AzureCoreContext' does not contain a definition for 'Default'

Check failure on line 143 in sdk/core/Azure.Core/src/RehydrationToken.Serialization.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib17)

sdk/core/Azure.Core/src/RehydrationToken.Serialization.cs#L143

sdk/core/Azure.Core/src/RehydrationToken.Serialization.cs(143,84): Error CS0117: 'AzureCoreContext' does not contain a definition for 'Default'
default:
throw new FormatException($"The model {nameof(RehydrationToken)} does not support '{options.Format}' format.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@

// TODO: Once we remove NextLinkOperationImplementation from internal shared and make it internal to Azure.Core only in https://github.com/Azure/azure-sdk-for-net/issues/43260
// We can access the internal members from RehydrationToken directly
var data = ModelReaderWriter.Write(rehydrationToken!, ModelReaderWriterOptions.Json);
var data = ModelReaderWriter.Write(rehydrationToken!, ModelReaderWriterOptions.Json, AzureCoreContext.Default);

Check failure on line 102 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET80_PackageRef_Debug)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L102

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(102,98): Error CS0103: The name 'AzureCoreContext' does not exist in the current context

Check failure on line 102 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L102

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(102,115): Error CS0117: 'AzureCoreContext' does not contain a definition for 'Default'

Check failure on line 102 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib19)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L102

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(102,115): Error CS0117: 'AzureCoreContext' does not contain a definition for 'Default'

Check failure on line 102 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib19)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L102

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(102,115): Error CS0117: 'AzureCoreContext' does not contain a definition for 'Default'

Check failure on line 102 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test MacOS_NET80_PackageRef_Debug)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L102

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(102,98): Error CS0103: The name 'AzureCoreContext' does not exist in the current context

Check failure on line 102 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib6)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L102

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(102,98): Error CS0103: The name 'AzureCoreContext' does not exist in the current context

Check failure on line 102 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test MacOS_NET90_ProjectRef_Release)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L102

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(102,115): Error CS0117: 'AzureCoreContext' does not contain a definition for 'Default'

Check failure on line 102 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib2)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L102

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(102,115): Error CS0117: 'AzureCoreContext' does not contain a definition for 'Default'

Check failure on line 102 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib10)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L102

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(102,98): Error CS0103: The name 'AzureCoreContext' does not exist in the current context

Check failure on line 102 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib3)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L102

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(102,115): Error CS0117: 'AzureCoreContext' does not contain a definition for 'Default'

Check failure on line 102 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib1)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L102

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(102,115): Error CS0117: 'AzureCoreContext' does not contain a definition for 'Default'

Check failure on line 102 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib8)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L102

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(102,98): Error CS0103: The name 'AzureCoreContext' does not exist in the current context

Check failure on line 102 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib4)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L102

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(102,115): Error CS0117: 'AzureCoreContext' does not contain a definition for 'Default'

Check failure on line 102 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib18)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L102

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(102,115): Error CS0117: 'AzureCoreContext' does not contain a definition for 'Default'

Check failure on line 102 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib18)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L102

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(102,98): Error CS0103: The name 'AzureCoreContext' does not exist in the current context

Check failure on line 102 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib14)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L102

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(102,98): Error CS0103: The name 'AzureCoreContext' does not exist in the current context

Check failure on line 102 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib12)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L102

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(102,98): Error CS0103: The name 'AzureCoreContext' does not exist in the current context

Check failure on line 102 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib15)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L102

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(102,98): Error CS0103: The name 'AzureCoreContext' does not exist in the current context

Check failure on line 102 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib13)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L102

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(102,98): Error CS0103: The name 'AzureCoreContext' does not exist in the current context

Check failure on line 102 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib16)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L102

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(102,98): Error CS0103: The name 'AzureCoreContext' does not exist in the current context

Check failure on line 102 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib9)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L102

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(102,98): Error CS0103: The name 'AzureCoreContext' does not exist in the current context

Check failure on line 102 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib11)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L102

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(102,98): Error CS0103: The name 'AzureCoreContext' does not exist in the current context

Check failure on line 102 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib5)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L102

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(102,115): Error CS0117: 'AzureCoreContext' does not contain a definition for 'Default'

Check failure on line 102 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib5)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L102

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(102,98): Error CS0103: The name 'AzureCoreContext' does not exist in the current context

Check failure on line 102 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib7)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L102

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(102,98): Error CS0103: The name 'AzureCoreContext' does not exist in the current context

Check failure on line 102 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib17)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L102

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(102,115): Error CS0117: 'AzureCoreContext' does not contain a definition for 'Default'

Check failure on line 102 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib17)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L102

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(102,98): Error CS0103: The name 'AzureCoreContext' does not exist in the current context

Check failure on line 102 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Analyze PRBatch)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L102

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(102,98): Error CS0103: The name 'AzureCoreContext' does not exist in the current context

Check failure on line 102 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Analyze PRBatch)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L102

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(102,98): Error CS0103: The name 'AzureCoreContext' does not exist in the current context

Check failure on line 102 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Analyze PRBatch)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L102

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(102,98): Error CS0103: The name 'AzureCoreContext' does not exist in the current context

Check failure on line 102 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L102

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(102,98): Error CS0103: The name 'AzureCoreContext' does not exist in the current context
using var document = JsonDocument.Parse(data);
var lroDetails = document.RootElement;

Expand Down Expand Up @@ -228,7 +228,7 @@
{"version":"{{RehydrationTokenVersion}}","id":{{ConstructStringValue(operationId)}},"requestMethod":"{{requestMethod}}","initialUri":"{{startRequestUri.AbsoluteUri}}","nextRequestUri":"{{nextRequestUri}}","headerSource":"{{headerSource}}","finalStateVia":"{{finalStateVia}}","lastKnownLocation":{{ConstructStringValue(lastKnownLocation)}}}
""";
var data = new BinaryData(json);
return ModelReaderWriter.Read<RehydrationToken>(data);
return ModelReaderWriter.Read<RehydrationToken>(data, ModelReaderWriterOptions.Json, AzureCoreContext.Default);

Check failure on line 231 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET80_PackageRef_Debug)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L231

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(231,98): Error CS0103: The name 'AzureCoreContext' does not exist in the current context

Check failure on line 231 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L231

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(231,115): Error CS0117: 'AzureCoreContext' does not contain a definition for 'Default'

Check failure on line 231 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib19)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L231

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(231,115): Error CS0117: 'AzureCoreContext' does not contain a definition for 'Default'

Check failure on line 231 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib19)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L231

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(231,115): Error CS0117: 'AzureCoreContext' does not contain a definition for 'Default'

Check failure on line 231 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test MacOS_NET80_PackageRef_Debug)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L231

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(231,98): Error CS0103: The name 'AzureCoreContext' does not exist in the current context

Check failure on line 231 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib6)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L231

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(231,98): Error CS0103: The name 'AzureCoreContext' does not exist in the current context

Check failure on line 231 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test MacOS_NET90_ProjectRef_Release)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L231

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(231,115): Error CS0117: 'AzureCoreContext' does not contain a definition for 'Default'

Check failure on line 231 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib2)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L231

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(231,115): Error CS0117: 'AzureCoreContext' does not contain a definition for 'Default'

Check failure on line 231 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib10)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L231

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(231,98): Error CS0103: The name 'AzureCoreContext' does not exist in the current context

Check failure on line 231 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib3)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L231

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(231,115): Error CS0117: 'AzureCoreContext' does not contain a definition for 'Default'

Check failure on line 231 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib1)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L231

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(231,115): Error CS0117: 'AzureCoreContext' does not contain a definition for 'Default'

Check failure on line 231 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib8)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L231

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(231,98): Error CS0103: The name 'AzureCoreContext' does not exist in the current context

Check failure on line 231 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib4)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L231

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(231,115): Error CS0117: 'AzureCoreContext' does not contain a definition for 'Default'

Check failure on line 231 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib18)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L231

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(231,115): Error CS0117: 'AzureCoreContext' does not contain a definition for 'Default'

Check failure on line 231 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib18)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L231

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(231,98): Error CS0103: The name 'AzureCoreContext' does not exist in the current context

Check failure on line 231 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib14)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L231

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(231,98): Error CS0103: The name 'AzureCoreContext' does not exist in the current context

Check failure on line 231 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib12)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L231

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(231,98): Error CS0103: The name 'AzureCoreContext' does not exist in the current context

Check failure on line 231 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib15)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L231

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(231,98): Error CS0103: The name 'AzureCoreContext' does not exist in the current context

Check failure on line 231 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib13)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L231

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(231,98): Error CS0103: The name 'AzureCoreContext' does not exist in the current context

Check failure on line 231 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib16)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L231

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(231,98): Error CS0103: The name 'AzureCoreContext' does not exist in the current context

Check failure on line 231 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib9)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L231

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(231,98): Error CS0103: The name 'AzureCoreContext' does not exist in the current context

Check failure on line 231 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib11)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L231

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(231,98): Error CS0103: The name 'AzureCoreContext' does not exist in the current context

Check failure on line 231 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib5)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L231

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(231,115): Error CS0117: 'AzureCoreContext' does not contain a definition for 'Default'

Check failure on line 231 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib5)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L231

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(231,98): Error CS0103: The name 'AzureCoreContext' does not exist in the current context

Check failure on line 231 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib7)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L231

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(231,98): Error CS0103: The name 'AzureCoreContext' does not exist in the current context

Check failure on line 231 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib17)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L231

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(231,115): Error CS0117: 'AzureCoreContext' does not contain a definition for 'Default'

Check failure on line 231 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Test Ubuntu2004_NET90_ProjectRef_Release_ib17)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L231

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(231,98): Error CS0103: The name 'AzureCoreContext' does not exist in the current context

Check failure on line 231 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Analyze PRBatch)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L231

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(231,98): Error CS0103: The name 'AzureCoreContext' does not exist in the current context

Check failure on line 231 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest (Build Analyze PRBatch)

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L231

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(231,98): Error CS0103: The name 'AzureCoreContext' does not exist in the current context

Check failure on line 231 in sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs

View check run for this annotation

Azure Pipelines / net - pullrequest

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs#L231

sdk/core/Azure.Core/src/Shared/NextLinkOperationImplementation.cs(231,98): Error CS0103: The name 'AzureCoreContext' does not exist in the current context
}

private static string? ConstructStringValue(string? value) => value is null ? "null" : $"\"{value}\"";
Expand Down
3 changes: 3 additions & 0 deletions sdk/core/Azure.Core/tests/RehydrationTokenTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ public void ThrowOnDeserializationWithNullRehydrationToken()
[Test]
public void ThrowOnDeserializationWithRehydrationTokenNullRequiredMember()
{
// net462 doesn't play well with validating debug asserts
#if !NETFRAMEWORK
var data = BinaryData.FromString("{\"requestMethod\": null}");
Assert.That(() => ModelReaderWriter.Read(data, typeof(RehydrationToken)), Throws.Exception);
#endif
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<TargetFrameworks>$(RequiredTargetFrameworks)</TargetFrameworks>
<IsTestProject>true</IsTestProject>
<Nullable>enable</Nullable>
<NoWarn>$(NoWarn);SCM0001</NoWarn>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using NUnit.Framework;
using System.ClientModel.Primitives;
using System.ClientModel.Tests.Client.ModelReaderWriterTests.Models;
using System.ClientModel.Tests.ModelReaderWriterTests;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Text.Json;
using NUnit.Framework;

namespace System.ClientModel.Tests.Internal.ModelReaderWriterTests
{
Expand Down Expand Up @@ -148,7 +147,7 @@ public void ConvertWithMissingInfo()
public void ConvertWithBadContext()
{
var options = new JsonSerializerOptions();
var converter = new JsonModelConverter(ModelReaderWriterOptions.Json, new BadContext());
var converter = new JsonModelConverter(ModelReaderWriterOptions.Json, SystemClientModelTestsInternalContext.Default);
options.Converters.Add(converter);
var ex = Assert.Throws<InvalidOperationException>(() => JsonSerializer.Deserialize("{}", typeof(PersistableModel), options));
Assert.IsNotNull(ex);
Expand Down Expand Up @@ -211,33 +210,11 @@ private static Dictionary<string, BinaryData> GetRawData(object model)
return (Dictionary<string, BinaryData>)propertyInfo!.GetValue(model)!;
}

private class BadContext : ModelReaderWriterContext
{
private PersistableModelInfo? _persistableModelInfo;

protected override bool TryGetTypeBuilderCore(Type type, out ModelReaderWriterTypeBuilder? builder)
{
builder = type switch
{
Type t when t == typeof(PersistableModel) => _persistableModelInfo ??= new(),
_ => null
};
return builder is not null;
}

private class PersistableModelInfo : ModelReaderWriterTypeBuilder
{
protected override Type BuilderType => typeof(DoesNotImplementPersistableModel);

protected override object CreateInstance() => new DoesNotImplementPersistableModel();
}
}

private class DoesNotImplementPersistableModel
internal class DoesNotImplementPersistableModel
{
}

private class PersistableModel : IJsonModel<PersistableModel>
internal class PersistableModel : IJsonModel<PersistableModel>
{
public PersistableModel Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => new();

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System.ClientModel.Primitives;
using System.Collections.Generic;

namespace System.ClientModel.Tests.Internal.ModelReaderWriterTests
{
internal partial class SystemClientModelTestsInternalContext : ModelReaderWriterContext
{
partial void AddAdditionalFactories(Dictionary<Type, Func<ModelReaderWriterTypeBuilder>> factories)
{
factories.Add(typeof(JsonModelConverterTests.PersistableModel), () => new PersistableModelInfo());
}

private class PersistableModelInfo : ModelReaderWriterTypeBuilder
{
protected override Type BuilderType => typeof(JsonModelConverterTests.DoesNotImplementPersistableModel);

protected override object CreateInstance() => new JsonModelConverterTests.DoesNotImplementPersistableModel();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

<ItemGroup>
<ProjectReference Include="..\..\src\System.ClientModel.csproj" />
<ProjectReference Include="..\..\gen\System.ClientModel.SourceGeneration.csproj" ReferenceOutputAssembly="false" OutputItemType="Analyzer" />
<ProjectReference Include="..\client\System.ClientModel.Tests.Client.csproj" />
<ProjectReference Include="..\System.ClientModel.Tests.csproj" />
</ItemGroup>
Expand Down
4 changes: 3 additions & 1 deletion sdk/openai/Azure.AI.OpenAI/src/Azure.AI.OpenAI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
<TargetFrameworks>$(RequiredTargetFrameworks)</TargetFrameworks>
<GenerateAPIListing>true</GenerateAPIListing>
<NoWarn>$(NoWarn);CS1591;AZC0012;AZC0102;CS8002;CS0436;AZC0112;OPENAI001;OPENAI002;AOAI001</NoWarn>
<!-- Needed until SCM goes GA with this fix https://github.com/Azure/azure-sdk-for-net/pull/49824 -->
<NoWarn>$(NoWarn);AZC0150</NoWarn>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>preview</LangVersion>
<Nullable>disable</Nullable>
Expand All @@ -25,7 +27,7 @@

<!-- TEMP until Azure.Core is released with updated SCM version -->
<ItemGroup>
<ProjectReference Include="..\..\..\core\System.ClientModel\src\System.ClientModel.csproj" />
<PackageReference Include="System.ClientModel" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Text.Json" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
-->
<PackageReference Include="Newtonsoft.Json" />
<PackageReference Include="System.ClientModel" />
<PackageReference Update="System.ClientModel" VersionOverride="1.4.0-beta.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
<PackageReference Include="Moq" />
<PackageReference Include="System.ValueTuple" />
<PackageReference Include="System.ClientModel" />
<PackageReference Update="System.ClientModel" VersionOverride="1.4.0-beta.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading