Skip to content

Commit 7b25ab4

Browse files
m-nashweshaggard
andauthored
Bump SCM version in packages.data.props (#49602)
* bump scm version to get an alpha azure.core out * update typo / api * bump version * add analyzer in internal csproj * bump scm version * fix stj * update references * update to scm 1.4.0 * Update Azure.AI.OpenAI.Tests.csproj * Update Azure.AI.OpenAI.Tests.csproj * remove version override * temp suppress azc0150 * revert new analyzer until azure.core GAs * revert one more context ref * update proj ref swap to deal with source generation --------- Co-authored-by: Wes Haggard <weshaggard@users.noreply.github.com>
1 parent 914781f commit 7b25ab4

13 files changed

+84
-28
lines changed

eng/Directory.Build.Common.targets

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,14 @@
195195

196196
<!-- Add ProjectReferences -->
197197
<ProjectReference Include="@(ProjectsToConvert -> '%(ProjectPath)')" />
198+
199+
<!-- Add System.ClientModel.SourceGeneration project reference if System.ClientModel was contained in ProjectsToConvert -->
200+
<_DependsOnSystemClientModel Include="@(ProjectsToConvert)" Exclude="System.ClientModel" />
201+
<ProjectReference
202+
Condition="'@(_DependsOnSystemClientModel)' != '@(ProjectsToConvert)'"
203+
Include="$(RepoRoot)\sdk\core\System.ClientModel\gen\System.ClientModel.SourceGeneration.csproj"
204+
ReferenceOutputAssembly="false"
205+
OutputItemType="Analyzer" />
198206
</ItemGroup>
199207

200208
<!--TODO: update build targets - ADO 5668-->

sdk/core/Azure.Core/api/Azure.Core.net462.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,12 @@ public partial struct AccessToken
307307
public override bool Equals(object? obj) { throw null; }
308308
public override int GetHashCode() { throw null; }
309309
}
310+
public partial class AzureCoreContext : System.ClientModel.Primitives.ModelReaderWriterContext
311+
{
312+
internal AzureCoreContext() { }
313+
public static Azure.Core.AzureCoreContext Default { get { throw null; } }
314+
protected override bool TryGetTypeBuilderCore(System.Type type, out System.ClientModel.Primitives.ModelReaderWriterTypeBuilder builder) { throw null; }
315+
}
310316
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
311317
public readonly partial struct AzureLocation : System.IEquatable<Azure.Core.AzureLocation>
312318
{

sdk/core/Azure.Core/api/Azure.Core.net472.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,12 @@ public partial struct AccessToken
307307
public override bool Equals(object? obj) { throw null; }
308308
public override int GetHashCode() { throw null; }
309309
}
310+
public partial class AzureCoreContext : System.ClientModel.Primitives.ModelReaderWriterContext
311+
{
312+
internal AzureCoreContext() { }
313+
public static Azure.Core.AzureCoreContext Default { get { throw null; } }
314+
protected override bool TryGetTypeBuilderCore(System.Type type, out System.ClientModel.Primitives.ModelReaderWriterTypeBuilder builder) { throw null; }
315+
}
310316
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
311317
public readonly partial struct AzureLocation : System.IEquatable<Azure.Core.AzureLocation>
312318
{

sdk/core/Azure.Core/api/Azure.Core.net6.0.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,12 @@ public partial struct AccessToken
307307
public override bool Equals(object? obj) { throw null; }
308308
public override int GetHashCode() { throw null; }
309309
}
310+
public partial class AzureCoreContext : System.ClientModel.Primitives.ModelReaderWriterContext
311+
{
312+
internal AzureCoreContext() { }
313+
public static Azure.Core.AzureCoreContext Default { get { throw null; } }
314+
protected override bool TryGetTypeBuilderCore(System.Type type, out System.ClientModel.Primitives.ModelReaderWriterTypeBuilder builder) { throw null; }
315+
}
310316
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
311317
public readonly partial struct AzureLocation : System.IEquatable<Azure.Core.AzureLocation>
312318
{

sdk/core/Azure.Core/api/Azure.Core.net8.0.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,12 @@ public partial struct AccessToken
314314
public override bool Equals(object? obj) { throw null; }
315315
public override int GetHashCode() { throw null; }
316316
}
317+
public partial class AzureCoreContext : System.ClientModel.Primitives.ModelReaderWriterContext
318+
{
319+
internal AzureCoreContext() { }
320+
public static Azure.Core.AzureCoreContext Default { get { throw null; } }
321+
protected override bool TryGetTypeBuilderCore(System.Type type, out System.ClientModel.Primitives.ModelReaderWriterTypeBuilder builder) { throw null; }
322+
}
317323
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
318324
public readonly partial struct AzureLocation : System.IEquatable<Azure.Core.AzureLocation>
319325
{

sdk/core/Azure.Core/api/Azure.Core.netstandard2.0.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,12 @@ public partial struct AccessToken
307307
public override bool Equals(object? obj) { throw null; }
308308
public override int GetHashCode() { throw null; }
309309
}
310+
public partial class AzureCoreContext : System.ClientModel.Primitives.ModelReaderWriterContext
311+
{
312+
internal AzureCoreContext() { }
313+
public static Azure.Core.AzureCoreContext Default { get { throw null; } }
314+
protected override bool TryGetTypeBuilderCore(System.Type type, out System.ClientModel.Primitives.ModelReaderWriterTypeBuilder builder) { throw null; }
315+
}
310316
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
311317
public readonly partial struct AzureLocation : System.IEquatable<Azure.Core.AzureLocation>
312318
{
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
using System.ClientModel.Primitives;
5+
6+
namespace Azure.Core
7+
{
8+
/// <summary>
9+
/// Context class used by <see cref="ModelReaderWriter"/> to read and write models in an AOT compatible way.
10+
/// </summary>
11+
public partial class AzureCoreContext : ModelReaderWriterContext
12+
{
13+
}
14+
}

sdk/core/Azure.Core/tests/RehydrationTokenTests.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ public void ThrowOnDeserializationWithNullRehydrationToken()
1818
[Test]
1919
public void ThrowOnDeserializationWithRehydrationTokenNullRequiredMember()
2020
{
21+
// net462 doesn't play well with validating debug asserts
22+
#if !NETFRAMEWORK
2123
var data = BinaryData.FromString("{\"requestMethod\": null}");
2224
Assert.That(() => ModelReaderWriter.Read(data, typeof(RehydrationToken)), Throws.Exception);
25+
#endif
2326
}
2427

2528
[Test]

sdk/core/System.ClientModel/tests/System.ClientModel.Tests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<TargetFrameworks>$(RequiredTargetFrameworks)</TargetFrameworks>
66
<IsTestProject>true</IsTestProject>
77
<Nullable>enable</Nullable>
8+
<NoWarn>$(NoWarn);SCM0001</NoWarn>
89
</PropertyGroup>
910

1011
<ItemGroup>

sdk/core/System.ClientModel/tests/internal/ModelReaderWriter/JsonModelConverterTests.cs

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

4-
using NUnit.Framework;
54
using System.ClientModel.Primitives;
65
using System.ClientModel.Tests.Client.ModelReaderWriterTests.Models;
76
using System.ClientModel.Tests.ModelReaderWriterTests;
87
using System.Collections.Generic;
9-
using System.Diagnostics.CodeAnalysis;
108
using System.Reflection;
119
using System.Text.Json;
10+
using NUnit.Framework;
1211

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

214-
private class BadContext : ModelReaderWriterContext
215-
{
216-
private PersistableModelInfo? _persistableModelInfo;
217-
218-
protected override bool TryGetTypeBuilderCore(Type type, out ModelReaderWriterTypeBuilder? builder)
219-
{
220-
builder = type switch
221-
{
222-
Type t when t == typeof(PersistableModel) => _persistableModelInfo ??= new(),
223-
_ => null
224-
};
225-
return builder is not null;
226-
}
227-
228-
private class PersistableModelInfo : ModelReaderWriterTypeBuilder
229-
{
230-
protected override Type BuilderType => typeof(DoesNotImplementPersistableModel);
231-
232-
protected override object CreateInstance() => new DoesNotImplementPersistableModel();
233-
}
234-
}
235-
236-
private class DoesNotImplementPersistableModel
213+
internal class DoesNotImplementPersistableModel
237214
{
238215
}
239216

240-
private class PersistableModel : IJsonModel<PersistableModel>
217+
internal class PersistableModel : IJsonModel<PersistableModel>
241218
{
242219
public PersistableModel Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => new();
243220

0 commit comments

Comments
 (0)