diff --git a/CHANGELOG.md b/CHANGELOG.md index c1a01e6c7..d5998ed37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## [v1.0.0-beta08] + +Fixes +* Fix bug in System.Text.Json converters that could cause errors when used with source generators + ## [v1.0.0-beta07] Breaking Changes: diff --git a/README.md b/README.md index d0e5b1a26..3b418410e 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ You must be using the .NET 7+ SDK (though you can compile for other target frame To use StronglyTypedIds, install the [StronglyTypedId NuGet package](https://www.nuget.org/packages/StronglyTypedId) into your _csproj_ file, for example by running ```bash -dotnet add package StronglyTypedId --version 1.0.0-beta07 +dotnet add package StronglyTypedId --version 1.0.0-beta08 ``` This adds a `<PackageReference>` to your project. You can additionally mark the package as `PrivateAsets="all"` and `ExcludeAssets="runtime"`. @@ -61,7 +61,7 @@ This adds a `<PackageReference>` to your project. You can additionally mark the <ItemGroup> <!-- Add the package --> - <PackageReference Include="StronglyTypedId" Version="1.0.0-beta07" PrivateAssets="all" ExcludeAssets="runtime" /> + <PackageReference Include="StronglyTypedId" Version="1.0.0-beta08" PrivateAssets="all" ExcludeAssets="runtime" /> <!-- --> </ItemGroup> @@ -270,7 +270,7 @@ The "template-based" design of StronglyTypedId is intended to make it easy to ge To make it easier to share templates with multiple people, and optional _StronglyTypedId.Templates_ NuGet package is available that includes various converters and other backing types. To use these templates, add the _StronglyTypedId.Templates_ package to your project: ```bash -dotnet add package StronglyTypedId.Templates --version 1.0.0-beta07 +dotnet add package StronglyTypedId.Templates --version 1.0.0-beta08 ``` You will then be able to reference any of the templates it includes. This includes "complete" implementations, including multiple converters, for various backing types: @@ -327,7 +327,7 @@ Your project file should look something like this: </PropertyGroup> <!-- Add the package --> - <PackageReference Include="StronglyTypedId" Version="1.0.0-beta07" + <PackageReference Include="StronglyTypedId" Version="1.0.0-beta08" PrivateAssets="all" ExcludeAssets="compile;runtime" /> <!-- ☝ Add compile to the list of excluded assets. --> @@ -352,7 +352,7 @@ If you wish to preserve these attributes in the build output, you can define the </PropertyGroup> <!-- Add the package --> - <PackageReference Include="StronglyTypedId" Version="1.0.0-beta07" PrivateAssets="all" /> + <PackageReference Include="StronglyTypedId" Version="1.0.0-beta08" PrivateAssets="all" /> <!-- ☝ You must not exclude the runtime assets in this case --> </Project> diff --git a/releasenotes.props b/releasenotes.props index a5d619e4d..8a67c27c5 100644 --- a/releasenotes.props +++ b/releasenotes.props @@ -3,6 +3,11 @@ <PackageReleaseNotes Condition="'$(VersionPrefix)' == '1.0.0'"> <![CDATA[ +## Changes in 1.0.0-beta08: + +Fixes +* Fix bug in System.Text.Json converters that could cause errors when used with source generators + ## Changes in 1.0.0-beta07: ⚠ WARNING ⚠ diff --git a/src/StronglyTypedIds/Constants.cs b/src/StronglyTypedIds/Constants.cs index 48111c713..2981adb52 100644 --- a/src/StronglyTypedIds/Constants.cs +++ b/src/StronglyTypedIds/Constants.cs @@ -2,7 +2,7 @@ namespace StronglyTypedIds { internal static class Constants { - public const string StronglyTypedIdsVersion = "1.0.0-beta7"; + public const string StronglyTypedIdsVersion = "1.0.0-beta08"; public const string Usage = nameof(Usage); } } diff --git a/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanGenerateDefaultIdInGlobalNamespace.verified.txt b/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanGenerateDefaultIdInGlobalNamespace.verified.txt index b1660f0b8..7599a6569 100644 --- a/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanGenerateDefaultIdInGlobalNamespace.verified.txt +++ b/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanGenerateDefaultIdInGlobalNamespace.verified.txt @@ -12,7 +12,7 @@ #nullable enable [global::System.ComponentModel.TypeConverter(typeof(MyIdTypeConverter))] [global::System.Text.Json.Serialization.JsonConverter(typeof(MyIdSystemTextJsonConverter))] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("StronglyTypedId", "1.0.0-beta7")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("StronglyTypedId", "1.0.0-beta08")] partial struct MyId : #if NET6_0_OR_GREATER global::System.ISpanFormattable, diff --git a/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanGenerateForCustomTemplate.verified.txt b/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanGenerateForCustomTemplate.verified.txt index 77c492554..9419767c6 100644 --- a/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanGenerateForCustomTemplate.verified.txt +++ b/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanGenerateForCustomTemplate.verified.txt @@ -12,7 +12,7 @@ #nullable enable namespace SomeNamespace { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("StronglyTypedId", "1.0.0-beta7")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("StronglyTypedId", "1.0.0-beta08")] [global::System.ComponentModel.TypeConverter(typeof(MyIdTypeConverter))] [global::System.Text.Json.Serialization.JsonConverter(typeof(MyIdSystemTextJsonConverter))] [global::Newtonsoft.Json.JsonConverter(typeof(MyIdNewtonsoftJsonConverter))] diff --git a/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanGenerateGenericVeryNestedIdInFileScopeNamespace.verified.txt b/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanGenerateGenericVeryNestedIdInFileScopeNamespace.verified.txt index bc454f405..59a3ffb75 100644 --- a/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanGenerateGenericVeryNestedIdInFileScopeNamespace.verified.txt +++ b/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanGenerateGenericVeryNestedIdInFileScopeNamespace.verified.txt @@ -18,7 +18,7 @@ namespace SomeNamespace { public partial struct InnerStruct { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("StronglyTypedId", "1.0.0-beta7")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("StronglyTypedId", "1.0.0-beta08")] partial struct MyId : #if NET6_0_OR_GREATER global::System.ISpanFormattable, diff --git a/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanGenerateIdInFileScopedNamespace.verified.txt b/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanGenerateIdInFileScopedNamespace.verified.txt index 30fdbf879..f3b7f1fef 100644 --- a/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanGenerateIdInFileScopedNamespace.verified.txt +++ b/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanGenerateIdInFileScopedNamespace.verified.txt @@ -14,7 +14,7 @@ namespace SomeNamespace { [global::System.ComponentModel.TypeConverter(typeof(MyIdTypeConverter))] [global::System.Text.Json.Serialization.JsonConverter(typeof(MyIdSystemTextJsonConverter))] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("StronglyTypedId", "1.0.0-beta7")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("StronglyTypedId", "1.0.0-beta08")] partial struct MyId : #if NET6_0_OR_GREATER global::System.ISpanFormattable, diff --git a/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanGenerateIdInNamespace.verified.txt b/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanGenerateIdInNamespace.verified.txt index 30fdbf879..f3b7f1fef 100644 --- a/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanGenerateIdInNamespace.verified.txt +++ b/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanGenerateIdInNamespace.verified.txt @@ -14,7 +14,7 @@ namespace SomeNamespace { [global::System.ComponentModel.TypeConverter(typeof(MyIdTypeConverter))] [global::System.Text.Json.Serialization.JsonConverter(typeof(MyIdSystemTextJsonConverter))] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("StronglyTypedId", "1.0.0-beta7")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("StronglyTypedId", "1.0.0-beta08")] partial struct MyId : #if NET6_0_OR_GREATER global::System.ISpanFormattable, diff --git a/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanGenerateMultipleIdsWithSameName.verified.txt b/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanGenerateMultipleIdsWithSameName.verified.txt index 2dc64e029..0aa443946 100644 --- a/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanGenerateMultipleIdsWithSameName.verified.txt +++ b/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanGenerateMultipleIdsWithSameName.verified.txt @@ -14,7 +14,7 @@ namespace MyContracts.V1 { [global::System.ComponentModel.TypeConverter(typeof(MyIdTypeConverter))] [global::System.Text.Json.Serialization.JsonConverter(typeof(MyIdSystemTextJsonConverter))] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("StronglyTypedId", "1.0.0-beta7")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("StronglyTypedId", "1.0.0-beta08")] partial struct MyId : #if NET6_0_OR_GREATER global::System.ISpanFormattable, @@ -246,7 +246,7 @@ namespace MyContracts.V2 { [global::System.ComponentModel.TypeConverter(typeof(MyIdTypeConverter))] [global::System.Text.Json.Serialization.JsonConverter(typeof(MyIdSystemTextJsonConverter))] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("StronglyTypedId", "1.0.0-beta7")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("StronglyTypedId", "1.0.0-beta08")] partial struct MyId : #if NET6_0_OR_GREATER global::System.ISpanFormattable, diff --git a/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanGenerateMultipleTemplatesWithBuiltIn.verified.txt b/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanGenerateMultipleTemplatesWithBuiltIn.verified.txt index 673d6926d..cfa5a58c6 100644 --- a/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanGenerateMultipleTemplatesWithBuiltIn.verified.txt +++ b/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanGenerateMultipleTemplatesWithBuiltIn.verified.txt @@ -10,7 +10,7 @@ #pragma warning disable 1591 // publicly visible type or member must be documented #nullable enable - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("StronglyTypedId", "1.0.0-beta7")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("StronglyTypedId", "1.0.0-beta08")] partial struct MyId { public partial class EfCoreValueConverter : global::Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter<MyId, global::System.Guid> diff --git a/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanGenerateMultipleTemplatesWithoutBuiltIn.verified.txt b/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanGenerateMultipleTemplatesWithoutBuiltIn.verified.txt index 90db96b54..f4ec11b83 100644 --- a/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanGenerateMultipleTemplatesWithoutBuiltIn.verified.txt +++ b/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanGenerateMultipleTemplatesWithoutBuiltIn.verified.txt @@ -10,7 +10,7 @@ #pragma warning disable 1591 // publicly visible type or member must be documented #nullable enable - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("StronglyTypedId", "1.0.0-beta7")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("StronglyTypedId", "1.0.0-beta08")] partial struct MyId { public partial class EfCoreValueConverter : global::Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter<MyId, global::System.Guid> diff --git a/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanGenerateNestedIdInFileScopeNamespace.verified.txt b/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanGenerateNestedIdInFileScopeNamespace.verified.txt index f68c9472d..e16f15830 100644 --- a/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanGenerateNestedIdInFileScopeNamespace.verified.txt +++ b/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanGenerateNestedIdInFileScopeNamespace.verified.txt @@ -16,7 +16,7 @@ namespace SomeNamespace { [global::System.ComponentModel.TypeConverter(typeof(MyIdTypeConverter))] [global::System.Text.Json.Serialization.JsonConverter(typeof(MyIdSystemTextJsonConverter))] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("StronglyTypedId", "1.0.0-beta7")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("StronglyTypedId", "1.0.0-beta08")] partial struct MyId : #if NET6_0_OR_GREATER global::System.ISpanFormattable, diff --git a/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanGenerateNonDefaultIdInNamespace.verified.txt b/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanGenerateNonDefaultIdInNamespace.verified.txt index a527f220d..2abc9be84 100644 --- a/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanGenerateNonDefaultIdInNamespace.verified.txt +++ b/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanGenerateNonDefaultIdInNamespace.verified.txt @@ -14,7 +14,7 @@ namespace SomeNamespace { [global::System.ComponentModel.TypeConverter(typeof(MyIdTypeConverter))] [global::System.Text.Json.Serialization.JsonConverter(typeof(MyIdSystemTextJsonConverter))] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("StronglyTypedId", "1.0.0-beta7")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("StronglyTypedId", "1.0.0-beta08")] partial struct MyId : #if NET6_0_OR_GREATER global::System.ISpanFormattable, diff --git a/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanGenerateVeryNestedIdInFileScopeNamespace.verified.txt b/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanGenerateVeryNestedIdInFileScopeNamespace.verified.txt index 79ebbdc66..7957b81ba 100644 --- a/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanGenerateVeryNestedIdInFileScopeNamespace.verified.txt +++ b/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanGenerateVeryNestedIdInFileScopeNamespace.verified.txt @@ -20,7 +20,7 @@ namespace SomeNamespace { [global::System.ComponentModel.TypeConverter(typeof(MyIdTypeConverter))] [global::System.Text.Json.Serialization.JsonConverter(typeof(MyIdSystemTextJsonConverter))] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("StronglyTypedId", "1.0.0-beta7")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("StronglyTypedId", "1.0.0-beta08")] partial struct MyId : #if NET6_0_OR_GREATER global::System.ISpanFormattable, diff --git a/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanOverrideDefaultsWithCustomTemplateUsingGlobalAttribute.verified.txt b/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanOverrideDefaultsWithCustomTemplateUsingGlobalAttribute.verified.txt index 35f3fc37a..8e87d5b6d 100644 --- a/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanOverrideDefaultsWithCustomTemplateUsingGlobalAttribute.verified.txt +++ b/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanOverrideDefaultsWithCustomTemplateUsingGlobalAttribute.verified.txt @@ -10,7 +10,7 @@ #pragma warning disable 1591 // publicly visible type or member must be documented #nullable enable - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("StronglyTypedId", "1.0.0-beta7")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("StronglyTypedId", "1.0.0-beta08")] [global::System.ComponentModel.TypeConverter(typeof(MyIdTypeConverter))] [global::System.Text.Json.Serialization.JsonConverter(typeof(MyIdSystemTextJsonConverter))] [global::Newtonsoft.Json.JsonConverter(typeof(MyIdNewtonsoftJsonConverter))] diff --git a/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanOverrideDefaultsWithTemplateUsingGlobalAttribute.verified.txt b/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanOverrideDefaultsWithTemplateUsingGlobalAttribute.verified.txt index 7157a5a28..b68bd9847 100644 --- a/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanOverrideDefaultsWithTemplateUsingGlobalAttribute.verified.txt +++ b/test/StronglyTypedIds.Tests/Snapshots/StronglyTypedIdGeneratorTests.CanOverrideDefaultsWithTemplateUsingGlobalAttribute.verified.txt @@ -12,7 +12,7 @@ #nullable enable [global::System.ComponentModel.TypeConverter(typeof(MyIdTypeConverter))] [global::System.Text.Json.Serialization.JsonConverter(typeof(MyIdSystemTextJsonConverter))] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("StronglyTypedId", "1.0.0-beta7")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("StronglyTypedId", "1.0.0-beta08")] partial struct MyId : #if NET6_0_OR_GREATER global::System.ISpanFormattable, diff --git a/version.props b/version.props index 4ab397a63..992754da0 100644 --- a/version.props +++ b/version.props @@ -1,7 +1,7 @@ <Project> <PropertyGroup> <VersionPrefix>1.0.0</VersionPrefix> - <VersionSuffix>beta07</VersionSuffix> + <VersionSuffix>beta08</VersionSuffix> <PackageVersion Condition="'$(VersionSuffix)' == ''">$(VersionPrefix)</PackageVersion> <PackageVersion Condition="'$(VersionSuffix)' != ''">$(VersionPrefix)-$(VersionSuffix)</PackageVersion> </PropertyGroup>