From d443c3afaf1acbf977d8b0710176521127eb2206 Mon Sep 17 00:00:00 2001 From: Val Melamed Date: Mon, 25 May 2026 17:02:50 -0400 Subject: [PATCH 01/22] fix: disable AoT, refactor Directory.Build.props --- Directory.Build.props | 100 +++++++++++++++++++++--------------------- 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index fe07603..9964e9f 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,4 +1,35 @@ + + + + true + + + true + + + true + + + true + + + true + + 0 @@ -8,7 +39,8 @@ - $(preprocessor_symbols);$(DefineConstants) + $(preprocessor_symbols);$(DefineConstants) $([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), 'Directory.Build.props')) @@ -27,9 +59,6 @@ $(NoWarn);IDE0058;IDE0290;IDE0130; true portable - true - true - true true true true @@ -47,8 +76,17 @@ true + + + true + true + + - + true vm vm2 @@ -103,20 +141,9 @@ FluentAssertions For *.Tests projects in the ./test folder: --> - - - true - - Exe - false - False false $(NoWarn); @@ -131,10 +158,12 @@ TestingPlatformServer/TestContainer capabilities, causing an infinite project reload loop (Solution Explorer flickering). Disabling the server capability stops the loop. Tests still run from CLI and VS Build+Run (Ctrl+R,A). --> - true + true - $(TestingPlatformCommandLineArguments) --coverage --coverage-output-format cobertura --coverage-settings "$(RepoRoot)coverage.settings.xml" + $(TestingPlatformCommandLineArguments) --coverage --coverage-output-format cobertura --coverage-settings "$(RepoRoot)coverage.settings.xml" @@ -168,15 +197,6 @@ FluentAssertions For non-test projects in the ./test folder (utilities, extensions, etc.): --> - - - true - - false @@ -208,18 +228,9 @@ - - - true - - Exe - false - False false $(NoWarn); @@ -247,9 +258,7 @@ $(DefineConstants);SHORT_RUN @@ -264,23 +273,14 @@ - - - true - - - false - false - - + + From cee30b2a5763f5b2da5678c6c3cb008ded6a5ee3 Mon Sep 17 00:00:00 2001 From: Val Melamed Date: Mon, 25 May 2026 18:11:17 -0400 Subject: [PATCH 02/22] chore: update vm2.TestUtilities package version to 1.5.2 and clarify package reference comments --- Directory.Build.props | 2 +- Directory.Packages.props | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 9964e9f..c08b1f1 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -278,7 +278,7 @@ - + diff --git a/Directory.Packages.props b/Directory.Packages.props index d7afc9b..82ae3f5 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -30,7 +30,7 @@ - + From 4397e92dde0ecba03afc984b832ae528589b3802 Mon Sep 17 00:00:00 2001 From: Val Melamed Date: Tue, 26 May 2026 13:14:15 -0400 Subject: [PATCH 03/22] refactor!: put the Newtonsoft.Json Ulid converter in a separate project/assembly, allowing for AoT in the main project and non-AoT in that converter only -- BREAKING CHANGE. Updated with diff-shared.sh. --- .github/workflows/CI.yaml | 1 + Directory.Build.props | 49 ++-- Directory.Packages.props | 20 +- README.md | 30 ++- .../UlidType.Benchmarks/packages.lock.json | 231 ++-------------- examples/packages.lock.json | 229 +--------------- .../UlidNsConverter.cs | 2 +- src/UlidNsConverter/UlidNsConverter.csproj | 34 +++ src/UlidNsConverter/packages.lock.json | 60 +++++ src/UlidTool/UlidTool.csproj | 2 + src/UlidTool/packages.lock.json | 230 +--------------- src/UlidType/Ulid.cs | 1 - src/UlidType/packages.lock.json | 210 --------------- src/UlidType/usings.cs | 6 +- test/UlidTool.Tests/packages.lock.json | 250 +----------------- .../NsJson/UlidNsConverterTests.cs | 22 +- test/UlidType.Tests/UlidType.Tests.csproj | 1 + test/UlidType.Tests/packages.lock.json | 248 ++--------------- test/UlidType.Tests/usings.cs | 4 +- 19 files changed, 209 insertions(+), 1421 deletions(-) rename src/{UlidType/Serialization/NsJson => UlidNsConverter}/UlidNsConverter.cs (98%) create mode 100644 src/UlidNsConverter/UlidNsConverter.csproj create mode 100644 src/UlidNsConverter/packages.lock.json diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index 64605d0..3add452 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -66,6 +66,7 @@ env: PACKAGE_PROJECTS: >- [ "src/UlidType/UlidType.csproj", + "src/UlidNsConverter/UlidNsConverter.csproj", "src/UlidTool/UlidTool.csproj" ] RUNNERS_OS: >- diff --git a/Directory.Build.props b/Directory.Build.props index c08b1f1..24fa7b9 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -76,15 +76,6 @@ true - - - true - true - - true @@ -92,7 +83,7 @@ vm2 vm2 packages and tools Val Melamed - Copyright ©2025 vm + Copyright ©2025-2026 vm MIT false git @@ -104,36 +95,35 @@ true - - - - - - - - + + + true + true + - - - - - - - - - - - all all + + + + + + + + + + - diff --git a/Directory.Packages.props b/Directory.Packages.props index 82ae3f5..96d4a0c 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -4,20 +4,9 @@ true - - - - - - - - - - - - + @@ -30,12 +19,15 @@ - + + - + + + diff --git a/README.md b/README.md index b444c9b..dbd9433 100644 --- a/README.md +++ b/README.md @@ -25,16 +25,17 @@ - [Why Do I Need `UlidFactory`?](#why-do-i-need-ulidfactory) - [The `vm2.UlidFactory` Class](#the-vm2ulidfactory-class) - [Randomness Provider (`vm2.IRandomNumberGenerator`)](#randomness-provider-vm2irandomnumbergenerator) - - [Timestamp Provider (`vm2.ITimestampProvider`)](#timestamp-provider-vm2itimestampprovider) + - [Timestamp Provider (`System.TimeProvider`)](#timestamp-provider-systemtimeprovider) + - [Serialization](#serialization) - [The `UlidFactory` in a Distributed System](#the-ulidfactory-in-a-distributed-system) - [Performance](#performance) - - [Related Packages](#related-packages) + - [Related Documents and Packages](#related-documents-and-packages) - [License](#license) ## Overview -A small, fast, and spec-compliant .NET package that implements +A small, fast, AoT ready, and **spec-compliant** .NET package that implements [Universally Unique Lexicographically Sortable Identifier (ULID)](https://github.com/ulid/spec). ULIDs combine a 48-bit timestamp (milliseconds since Unix epoch) with 80 bits of randomness, producing compact 128-bit @@ -257,16 +258,15 @@ generating a new random value. ### The `vm2.UlidFactory` Class The `vm2.UlidFactory` class encapsulates the requirements and exposes a simple interface for generating ULIDs. Use multiple -`vm2.UlidFactory` instances when needed, e.g. one per database table or entity type. +`vm2.UlidFactory` instances when needed, e.g. one per aggregate root or database table. -ULID factories are thread-safe and ensure monotonicity of generated ULIDs across application contexts. -The factory uses two providers: one for the random bytes and one for the timestamp. +ULID factories are thread-safe and ensure monotonicity of generated ULIDs across application contexts. The factory uses two providers: one for the random bytes and one for the timestamp. Use dependency injection to construct the factory and manage the providers. DI keeps the provider lifetimes explicit, makes testing simple, and enforces a single, consistent configuration across the app or service. In simple scenarios, use the static method `vm2.Ulid.NewUlid()` instead of `vm2.UlidFactory`. It uses an internal single static -factory instance with a cryptographic random number generator and `DateTimeOffset.UtcNow` based clock. +factory instance with a cryptographic random number generator and a clock based on `System.TimeProvider.System.GetUtcNow().ToUnixTimeMilliseconds()`. #### Randomness Provider (`vm2.IRandomNumberGenerator`) @@ -276,12 +276,18 @@ e.g. for testing purposes, for performance reasons, or if you are concerned abou can explicitly specify that the factory should use the pseudo-random number generator `vm2.UlidRandomProviders.PseudoRandom`. You can also provide your own, thread-safe implementation of `vm2.IRandomNumberGenerator` to the factory. -#### Timestamp Provider (`vm2.ITimestampProvider`) +#### Timestamp Provider (`System.TimeProvider`) -By default, the timestamp provider uses `DateTimeOffset.UtcNow` converted to Unix epoch time in milliseconds. If you need a -different source of time, e.g. for testing purposes, you can provide your own implementation of `vm2.ITimestampProvider` to the +By default, the timestamp provider uses `System.TimeProvider.System.GetUtcNow().ToUnixTimeMilliseconds()` converted to Unix epoch time in milliseconds. If you need a different source of time, e.g. for testing purposes, you can override the .NET BCL class `System.TimeProvider` or for testing purposes `System.FakeTimeProvider` to provide your own implementation. factory. +#### Serialization + +The `vm2.Ulid` type is marked with the `System.Text.Json.Serialization.JsonConverterAttribute` attribute, so it can be serialized and deserialized by `System.Text.Json` without any additional configuration. For Newtonsoft.Json, use the companion package `vm2.UlidSerialization.NsJson` ([source code](https://github.com/vmelamed/vm2.Ulid/blob/main/src/UlidNsConverter)). + +> [!WARNING] +> The `vm2.UlidSerialization.NsJson` package depends on Newtonsoft.Json, which is not AoT compatible. + ### The `UlidFactory` in a Distributed System In distributed database applications and services, ULIDs are often generated across many nodes. Design for collision avoidance @@ -335,10 +341,12 @@ Legend: random number generator on every call, whereas `Ulid.NewUlid` only uses it when the millisecond timestamp changes and if it doesn't, it simply increments the random part of the previous call. -## Related Packages +## Related Documents and Packages - **[ULID Specification](https://github.com/ulid/spec)** - Official ULID spec +- **[vm2.UlidSerialization.NsJson](https://github.com/vmelamed/vm2.Ulid/blob/main/src/UlidNsConverter)** - Companion package: Newtonsoft.Json converter for vm2.Ulid - **[vm2.UlidTool](https://github.com/vmelamed/vm2.Ulid/blob/main/src/UlidTool)** - ULID Generator Command Line Tool +- **[Example](https://github.com/vmelamed/vm2.Ulid/blob/main/examples/GenerateUlids.cs)** - Basic usage example ## License diff --git a/benchmarks/UlidType.Benchmarks/packages.lock.json b/benchmarks/UlidType.Benchmarks/packages.lock.json index 366e7df..15033ef 100644 --- a/benchmarks/UlidType.Benchmarks/packages.lock.json +++ b/benchmarks/UlidType.Benchmarks/packages.lock.json @@ -26,131 +26,12 @@ "resolved": "0.15.8", "contentHash": "hfucY0ycAsB0SsoaZcaAp9oq5wlWBJcylvEJb9pmvdYUx6PD6S4mDiYnZWjdjAlLhIpe/xtGCwzORfzAzPqvzA==" }, - "Microsoft.Extensions.Configuration.Binder": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "R3NN1X+kVu14uoxLEW6sBSQyhogDSbaOQzILnCtuXxBN4hx22AgjWPwZX6v/suERFkEDgU1lk12AglHTrUxhlw==", - "dependencies": { - "Microsoft.Extensions.Configuration": "10.0.8", - "Microsoft.Extensions.Configuration.Abstractions": "10.0.8" - } - }, - "Microsoft.Extensions.Configuration.CommandLine": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "nQXq1a4MiInYh+0VF9fguxAl06q2ftmOyYQ+5e933s4rk57xjgkbTjUdFUySzjrcrvDeWsSqlZB+TE8+TbM2HA==", - "dependencies": { - "Microsoft.Extensions.Configuration": "10.0.8", - "Microsoft.Extensions.Configuration.Abstractions": "10.0.8" - } - }, - "Microsoft.Extensions.Configuration.EnvironmentVariables": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "bVGqctAfPGfTxJvNp8pMshtvpsUj6r6JkeiCNVIGVYO5gBxuxdN0Lbr25kEvE/zXdctkEc44g8HssnPgDnFGVA==", - "dependencies": { - "Microsoft.Extensions.Configuration": "10.0.8", - "Microsoft.Extensions.Configuration.Abstractions": "10.0.8" - } - }, - "Microsoft.Extensions.Configuration.Json": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "KLtAZ6A38s1pIfCO2ns6aG14NNGMYNZ4PBYfFK4M+R4A+xuSc6oklhqDcpHZxvDpyBWeFtR5C8iQBw2ng8tUHQ==", - "dependencies": { - "Microsoft.Extensions.Configuration": "10.0.8", - "Microsoft.Extensions.Configuration.Abstractions": "10.0.8", - "Microsoft.Extensions.Configuration.FileExtensions": "10.0.8", - "Microsoft.Extensions.FileProviders.Abstractions": "10.0.8" - } - }, - "Microsoft.Extensions.DependencyInjection": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "daf62xHIrq8pnE709hgaZZN9tSam9TGGepWe1+bE6V3GEuVwJiMs6ib+38lfMCyAJAHiX0vapxBhsuMSV7U+cg==", - "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.8" - } - }, - "Microsoft.Extensions.Logging": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "K60JhWC2hN/Gi7TP68tBxSzk5ACWOs7lkmPzsfA8Bcf/IXTajujt2ORMf9rSMk1bsng6Lv4Y3fuxp3bm1+15ug==", - "dependencies": { - "Microsoft.Extensions.DependencyInjection": "10.0.8", - "Microsoft.Extensions.Logging.Abstractions": "10.0.8", - "Microsoft.Extensions.Options": "10.0.8" - } - }, - "Microsoft.Extensions.Logging.Abstractions": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "fdVadZmsC8jRP0KvKy8mO8f6GV/HyBvElfcSxEhd+5FM5boAw/01iSaCto5G3G37ApJira4A3pNaVvBv8cUiLQ==", - "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.8" - } - }, - "Microsoft.Extensions.Logging.Configuration": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "rxSLTO7xTbcC3DuEJHNEijBr8g14Jj62zQ+DeFu68bsoTYoU8jLcMhc1735PV21bESXsATlL5LsfaWH71FOWAg==", - "dependencies": { - "Microsoft.Extensions.Configuration": "10.0.8", - "Microsoft.Extensions.Configuration.Abstractions": "10.0.8", - "Microsoft.Extensions.Configuration.Binder": "10.0.8", - "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.8", - "Microsoft.Extensions.Logging": "10.0.8", - "Microsoft.Extensions.Logging.Abstractions": "10.0.8", - "Microsoft.Extensions.Options": "10.0.8", - "Microsoft.Extensions.Options.ConfigurationExtensions": "10.0.8" - } - }, - "Microsoft.Extensions.Logging.Console": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "6cv53sHsPnFS56PJw8X4GbNcjeX1KGyFJRxJWvxOgK63cnqeSB1k1eRwjUdkse0tBhwlH6qc9EOYDlan+CYTuw==", - "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.8", - "Microsoft.Extensions.Logging": "10.0.8", - "Microsoft.Extensions.Logging.Abstractions": "10.0.8", - "Microsoft.Extensions.Logging.Configuration": "10.0.8", - "Microsoft.Extensions.Options": "10.0.8" - } - }, - "Microsoft.Extensions.Options.ConfigurationExtensions": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "VOapXeO3lhBH0zYoyAH7tjapuo4V5pTHlevPpiSHueEquAajqd5nF0mttm+h/uE/exwAEuM5s26SzOJtletE3w==", - "dependencies": { - "Microsoft.Extensions.Configuration.Abstractions": "10.0.8", - "Microsoft.Extensions.Configuration.Binder": "10.0.8", - "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.8", - "Microsoft.Extensions.Options": "10.0.8", - "Microsoft.Extensions.Primitives": "10.0.8" - } - }, "Microsoft.Extensions.TimeProvider.Testing": { "type": "Direct", "requested": "[10.6.0, )", "resolved": "10.6.0", "contentHash": "qQDiaYWpvIymGbu+kXaMDS8YdqfeQkv6DOxPF2GSwC+eSzIKqOOnSP34TYt7gKqvB7p8/aSptexnW6nF0CUdnw==" }, - "Microsoft.NET.ILLink.Tasks": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "dVbSXGIFNR5nZcv2tOLoWI+a9T4jtFd77IYjuND+QVe360qWgAF7H0WtoopYhRw/+SgpGUTyrkrh+65+ClNnfw==" - }, "Microsoft.SourceLink.GitHub": { "type": "Direct", "requested": "[10.0.300, )", @@ -168,22 +49,6 @@ "resolved": "7.0.0", "contentHash": "2lMTCQl5bGP4iv0JNkockPnyllC6eHLz+CoK2ICvalvHod+exXSxueu9hq+zNkU7bZBJf8wMfeRC/Edn8AGmEg==" }, - "Newtonsoft.Json": { - "type": "Direct", - "requested": "[13.0.4, )", - "resolved": "13.0.4", - "contentHash": "pdgNNMai3zv51W5aq268sujXUyx7SNdE2bj1wZcWjAQrKMFZV260lbqYop1d2GM67JI1huLRwxo9ZqnfF/lC6A==" - }, - "System.Configuration.ConfigurationManager": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "QG+HHwJjLyUiRuA9axr5pDqHAxboo7FXCTRakxMABE9CUAUij/tsd/MsgQPJUEppkf+YBLT+F/P/wKIVCAIcNg==", - "dependencies": { - "System.Diagnostics.EventLog": "10.0.8", - "System.Security.Cryptography.ProtectedData": "10.0.8" - } - }, "CommandLineParser": { "type": "Transitive", "resolved": "2.9.1", @@ -259,76 +124,48 @@ "resolved": "3.1.6", "contentHash": "jek4XYaQ/PGUwDKKhwR8K47Uh1189PFzMeLqO83mXrXQVIpARZCcfuDedH50YDTepBkfijCZN5U/vZi++erxtg==" }, - "Microsoft.Extensions.Configuration": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "ehZcoPbjzWzS4XFvuz7R3V55SmpdkyMqFURLH3yXaN9NtXd9tR6CGB7pd49HYtCkenl+G7ctXSFLhNI08xLfRg==", - "dependencies": { - "Microsoft.Extensions.Configuration.Abstractions": "10.0.8", - "Microsoft.Extensions.Primitives": "10.0.8" - } - }, - "Microsoft.Extensions.Configuration.Abstractions": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "I63esIFbL3h5pSt7gXpXOlmcwDmYBUoYNEglKfDPFUqtYvSV84f2l28hO2lfVXsV0wdlplgAM7IVz16matapSg==", - "dependencies": { - "Microsoft.Extensions.Primitives": "10.0.8" - } - }, - "Microsoft.Extensions.Configuration.FileExtensions": { + "Microsoft.Extensions.DependencyInjection": { "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "1g9mzuu8gIHkjYb0jLxOTQVl/QDG5nn0b0JzgT/gbgNKr6gXZzxOHRAsdYRc1eDApB7LdHR8uK5vQrNjIQdRrQ==", + "resolved": "6.0.0", + "contentHash": "k6PWQMuoBDGGHOQTtyois2u4AwyVcIwL2LaSLlTZQm2CYcJ1pxbt6jfAnpWmzENA/wfrYRI/X9DTLoUkE4AsLw==", "dependencies": { - "Microsoft.Extensions.Configuration": "10.0.8", - "Microsoft.Extensions.Configuration.Abstractions": "10.0.8", - "Microsoft.Extensions.FileProviders.Abstractions": "10.0.8", - "Microsoft.Extensions.FileProviders.Physical": "10.0.8", - "Microsoft.Extensions.Primitives": "10.0.8" + "Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0" } }, "Microsoft.Extensions.DependencyInjection.Abstractions": { "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "21nbDV60SRPWGIivsyl6lqBeEJNG1sginhhfWgRrr3Ais7aQ12To25OAHQxgoiJkjqy1aQ6RxpZBGYuTi7Ge6A==" + "resolved": "6.0.0", + "contentHash": "xlzi2IYREJH3/m6+lUrQlujzX8wDitm4QGnUu6kUXTQAWPuZY8i+ticFJbzfqaetLA6KR/rO6Ew/HuYD+bxifg==" }, - "Microsoft.Extensions.FileProviders.Abstractions": { + "Microsoft.Extensions.Logging": { "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "U+oquaPxFdY8lYeEIWO/AD7jDIl9sPW6aVWMQRHU/pZ/SWpLcOrAj2fcLe1HwXl4sYw1ONI56K/eELT3xr4RRQ==", + "resolved": "6.0.0", + "contentHash": "eIbyj40QDg1NDz0HBW0S5f3wrLVnKWnDJ/JtZ+yJDFnDj90VoPuoPmFkeaXrtu+0cKm5GRAwoDf+dBWXK0TUdg==", "dependencies": { - "Microsoft.Extensions.Primitives": "10.0.8" + "Microsoft.Extensions.DependencyInjection": "6.0.0", + "Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0", + "Microsoft.Extensions.Logging.Abstractions": "6.0.0", + "Microsoft.Extensions.Options": "6.0.0" } }, - "Microsoft.Extensions.FileProviders.Physical": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "GkPvQe6IdidLu6Q3Lw6+B8NJpW8feW8czZ5mBKt5rXM/x8MvZfEp5WvAsjznzDGd23chIDrW0b2mmt+ScnEgiw==", - "dependencies": { - "Microsoft.Extensions.FileProviders.Abstractions": "10.0.8", - "Microsoft.Extensions.FileSystemGlobbing": "10.0.8", - "Microsoft.Extensions.Primitives": "10.0.8" - } - }, - "Microsoft.Extensions.FileSystemGlobbing": { + "Microsoft.Extensions.Logging.Abstractions": { "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "IUQet3SY51xIFcFZKtAB6a54/Zdxs7T3SQ84kJtOD6yeXfZgiOMksACWD5qtTmXGQGFH4QYGBOT0KIO8Uy/dJw==" + "resolved": "6.0.0", + "contentHash": "/HggWBbTwy8TgebGSX5DBZ24ndhzi93sHUBDvP1IxbZD7FDokYzdAr6+vbWGjw2XAfR2EJ1sfKUotpjHnFWPxA==" }, "Microsoft.Extensions.Options": { "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "VBD+131DpTNCNDfA4kIyKTiCySvJGNhwibdWBSdFRu7GMfXLXcXODkgA+KStKbbhzraLglZWUN4nXyHgW4JIRA==", + "resolved": "6.0.0", + "contentHash": "dzXN0+V1AyjOe2xcJ86Qbo233KHuLEY0njf/P2Kw8SfJU+d45HNS2ctJdnEnrWbM9Ye2eFgaC5Mj9otRMU6IsQ==", "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.8", - "Microsoft.Extensions.Primitives": "10.0.8" + "Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0", + "Microsoft.Extensions.Primitives": "6.0.0" } }, "Microsoft.Extensions.Primitives": { "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "OBPo4nYhMyIbtueoC10CBm6AGAbo/A9IV8QQ/6ryZS7VvmqpGT7hunazeHLxFawRzn3oLOq4jhqhpBX4tfswWQ==" + "resolved": "6.0.0", + "contentHash": "9+PnzmQFfEFNR9J2aDTfJGGupShHjOuGw4VUv+JB044biSHrnmCIMD+mJHmb2H7YryrfBEXDurxQ47gJZdCKNQ==" }, "Microsoft.SourceLink.Common": { "type": "Transitive", @@ -353,11 +190,6 @@ "resolved": "9.0.5", "contentHash": "cuzLM2MWutf9ZBEMPYYfd0DXwYdvntp7VCT6a/wvbKCa2ZuvGmW74xi+YBa2mrfEieAXqM4TNKlMmSnfAfpUoQ==" }, - "System.Diagnostics.EventLog": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "+Ro7WgIom+BDNH+YhTuZKL6QJ0ctfOpTyfUG/h3aU5KwXt3OaNf0wYWrTvoBUj+34Dy5V8dN9yCco1hAJQ4txw==" - }, "System.IO.Hashing": { "type": "Transitive", "resolved": "10.0.8", @@ -376,27 +208,10 @@ "resolved": "4.7.0", "contentHash": "VybpaOQQhqE6siHppMktjfGBw1GCwvCqiufqmP8F1nj7fTUNtW35LOEt3UZTEsECfo+ELAl/9o9nJx3U91i7vA==" }, - "System.Security.Cryptography.ProtectedData": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "/ldVgSfImIBp6fLWS7sLH0BnmtFj0ZwGlZo4Xx2q0K3ZhJNDbW45kj2f6zPoC+L+BTINuHdMzTsopuwmkbgcNA==" - }, "vm2.Ulid": { "type": "Project", "dependencies": { - "Microsoft.Extensions.Configuration.Binder": "[10.0.8, )", - "Microsoft.Extensions.Configuration.CommandLine": "[10.0.8, )", - "Microsoft.Extensions.Configuration.EnvironmentVariables": "[10.0.8, )", - "Microsoft.Extensions.Configuration.Json": "[10.0.8, )", - "Microsoft.Extensions.DependencyInjection": "[10.0.8, )", - "Microsoft.Extensions.Logging": "[10.0.8, )", - "Microsoft.Extensions.Logging.Abstractions": "[10.0.8, )", - "Microsoft.Extensions.Logging.Configuration": "[10.0.8, )", - "Microsoft.Extensions.Logging.Console": "[10.0.8, )", - "Microsoft.Extensions.Options.ConfigurationExtensions": "[10.0.8, )", - "Microsoft.Extensions.TimeProvider.Testing": "[10.6.0, )", - "Newtonsoft.Json": "[13.0.4, )", - "System.Configuration.ConfigurationManager": "[10.0.8, )" + "Microsoft.Extensions.TimeProvider.Testing": "[10.6.0, )" } } } diff --git a/examples/packages.lock.json b/examples/packages.lock.json index 78a433b..8b0534e 100644 --- a/examples/packages.lock.json +++ b/examples/packages.lock.json @@ -8,119 +8,6 @@ "resolved": "10.0.8", "contentHash": "RJxitcN5CCyZDcPNXKLsecwKvACzmy8C1z8hGM9+hFcnPhv1jDysJFFIeUHIPWaZ6wDAfYtZcgKEtegvL2Nz8A==" }, - "Microsoft.Extensions.Configuration.Binder": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "R3NN1X+kVu14uoxLEW6sBSQyhogDSbaOQzILnCtuXxBN4hx22AgjWPwZX6v/suERFkEDgU1lk12AglHTrUxhlw==", - "dependencies": { - "Microsoft.Extensions.Configuration": "10.0.8", - "Microsoft.Extensions.Configuration.Abstractions": "10.0.8" - } - }, - "Microsoft.Extensions.Configuration.CommandLine": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "nQXq1a4MiInYh+0VF9fguxAl06q2ftmOyYQ+5e933s4rk57xjgkbTjUdFUySzjrcrvDeWsSqlZB+TE8+TbM2HA==", - "dependencies": { - "Microsoft.Extensions.Configuration": "10.0.8", - "Microsoft.Extensions.Configuration.Abstractions": "10.0.8" - } - }, - "Microsoft.Extensions.Configuration.EnvironmentVariables": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "bVGqctAfPGfTxJvNp8pMshtvpsUj6r6JkeiCNVIGVYO5gBxuxdN0Lbr25kEvE/zXdctkEc44g8HssnPgDnFGVA==", - "dependencies": { - "Microsoft.Extensions.Configuration": "10.0.8", - "Microsoft.Extensions.Configuration.Abstractions": "10.0.8" - } - }, - "Microsoft.Extensions.Configuration.Json": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "KLtAZ6A38s1pIfCO2ns6aG14NNGMYNZ4PBYfFK4M+R4A+xuSc6oklhqDcpHZxvDpyBWeFtR5C8iQBw2ng8tUHQ==", - "dependencies": { - "Microsoft.Extensions.Configuration": "10.0.8", - "Microsoft.Extensions.Configuration.Abstractions": "10.0.8", - "Microsoft.Extensions.Configuration.FileExtensions": "10.0.8", - "Microsoft.Extensions.FileProviders.Abstractions": "10.0.8" - } - }, - "Microsoft.Extensions.DependencyInjection": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "daf62xHIrq8pnE709hgaZZN9tSam9TGGepWe1+bE6V3GEuVwJiMs6ib+38lfMCyAJAHiX0vapxBhsuMSV7U+cg==", - "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.8" - } - }, - "Microsoft.Extensions.Logging": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "K60JhWC2hN/Gi7TP68tBxSzk5ACWOs7lkmPzsfA8Bcf/IXTajujt2ORMf9rSMk1bsng6Lv4Y3fuxp3bm1+15ug==", - "dependencies": { - "Microsoft.Extensions.DependencyInjection": "10.0.8", - "Microsoft.Extensions.Logging.Abstractions": "10.0.8", - "Microsoft.Extensions.Options": "10.0.8" - } - }, - "Microsoft.Extensions.Logging.Abstractions": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "fdVadZmsC8jRP0KvKy8mO8f6GV/HyBvElfcSxEhd+5FM5boAw/01iSaCto5G3G37ApJira4A3pNaVvBv8cUiLQ==", - "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.8" - } - }, - "Microsoft.Extensions.Logging.Configuration": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "rxSLTO7xTbcC3DuEJHNEijBr8g14Jj62zQ+DeFu68bsoTYoU8jLcMhc1735PV21bESXsATlL5LsfaWH71FOWAg==", - "dependencies": { - "Microsoft.Extensions.Configuration": "10.0.8", - "Microsoft.Extensions.Configuration.Abstractions": "10.0.8", - "Microsoft.Extensions.Configuration.Binder": "10.0.8", - "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.8", - "Microsoft.Extensions.Logging": "10.0.8", - "Microsoft.Extensions.Logging.Abstractions": "10.0.8", - "Microsoft.Extensions.Options": "10.0.8", - "Microsoft.Extensions.Options.ConfigurationExtensions": "10.0.8" - } - }, - "Microsoft.Extensions.Logging.Console": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "6cv53sHsPnFS56PJw8X4GbNcjeX1KGyFJRxJWvxOgK63cnqeSB1k1eRwjUdkse0tBhwlH6qc9EOYDlan+CYTuw==", - "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.8", - "Microsoft.Extensions.Logging": "10.0.8", - "Microsoft.Extensions.Logging.Abstractions": "10.0.8", - "Microsoft.Extensions.Logging.Configuration": "10.0.8", - "Microsoft.Extensions.Options": "10.0.8" - } - }, - "Microsoft.Extensions.Options.ConfigurationExtensions": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "VOapXeO3lhBH0zYoyAH7tjapuo4V5pTHlevPpiSHueEquAajqd5nF0mttm+h/uE/exwAEuM5s26SzOJtletE3w==", - "dependencies": { - "Microsoft.Extensions.Configuration.Abstractions": "10.0.8", - "Microsoft.Extensions.Configuration.Binder": "10.0.8", - "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.8", - "Microsoft.Extensions.Options": "10.0.8", - "Microsoft.Extensions.Primitives": "10.0.8" - } - }, "Microsoft.Extensions.TimeProvider.Testing": { "type": "Direct", "requested": "[10.6.0, )", @@ -150,22 +37,6 @@ "resolved": "7.0.0", "contentHash": "2lMTCQl5bGP4iv0JNkockPnyllC6eHLz+CoK2ICvalvHod+exXSxueu9hq+zNkU7bZBJf8wMfeRC/Edn8AGmEg==" }, - "Newtonsoft.Json": { - "type": "Direct", - "requested": "[13.0.4, )", - "resolved": "13.0.4", - "contentHash": "pdgNNMai3zv51W5aq268sujXUyx7SNdE2bj1wZcWjAQrKMFZV260lbqYop1d2GM67JI1huLRwxo9ZqnfF/lC6A==" - }, - "System.Configuration.ConfigurationManager": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "QG+HHwJjLyUiRuA9axr5pDqHAxboo7FXCTRakxMABE9CUAUij/tsd/MsgQPJUEppkf+YBLT+F/P/wKIVCAIcNg==", - "dependencies": { - "System.Diagnostics.EventLog": "10.0.8", - "System.Security.Cryptography.ProtectedData": "10.0.8" - } - }, "Microsoft.Build.Tasks.Git": { "type": "Transitive", "resolved": "10.0.300", @@ -174,113 +45,20 @@ "System.IO.Hashing": "10.0.8" } }, - "Microsoft.Extensions.Configuration": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "ehZcoPbjzWzS4XFvuz7R3V55SmpdkyMqFURLH3yXaN9NtXd9tR6CGB7pd49HYtCkenl+G7ctXSFLhNI08xLfRg==", - "dependencies": { - "Microsoft.Extensions.Configuration.Abstractions": "10.0.8", - "Microsoft.Extensions.Primitives": "10.0.8" - } - }, - "Microsoft.Extensions.Configuration.Abstractions": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "I63esIFbL3h5pSt7gXpXOlmcwDmYBUoYNEglKfDPFUqtYvSV84f2l28hO2lfVXsV0wdlplgAM7IVz16matapSg==", - "dependencies": { - "Microsoft.Extensions.Primitives": "10.0.8" - } - }, - "Microsoft.Extensions.Configuration.FileExtensions": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "1g9mzuu8gIHkjYb0jLxOTQVl/QDG5nn0b0JzgT/gbgNKr6gXZzxOHRAsdYRc1eDApB7LdHR8uK5vQrNjIQdRrQ==", - "dependencies": { - "Microsoft.Extensions.Configuration": "10.0.8", - "Microsoft.Extensions.Configuration.Abstractions": "10.0.8", - "Microsoft.Extensions.FileProviders.Abstractions": "10.0.8", - "Microsoft.Extensions.FileProviders.Physical": "10.0.8", - "Microsoft.Extensions.Primitives": "10.0.8" - } - }, - "Microsoft.Extensions.DependencyInjection.Abstractions": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "21nbDV60SRPWGIivsyl6lqBeEJNG1sginhhfWgRrr3Ais7aQ12To25OAHQxgoiJkjqy1aQ6RxpZBGYuTi7Ge6A==" - }, - "Microsoft.Extensions.FileProviders.Abstractions": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "U+oquaPxFdY8lYeEIWO/AD7jDIl9sPW6aVWMQRHU/pZ/SWpLcOrAj2fcLe1HwXl4sYw1ONI56K/eELT3xr4RRQ==", - "dependencies": { - "Microsoft.Extensions.Primitives": "10.0.8" - } - }, - "Microsoft.Extensions.FileProviders.Physical": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "GkPvQe6IdidLu6Q3Lw6+B8NJpW8feW8czZ5mBKt5rXM/x8MvZfEp5WvAsjznzDGd23chIDrW0b2mmt+ScnEgiw==", - "dependencies": { - "Microsoft.Extensions.FileProviders.Abstractions": "10.0.8", - "Microsoft.Extensions.FileSystemGlobbing": "10.0.8", - "Microsoft.Extensions.Primitives": "10.0.8" - } - }, - "Microsoft.Extensions.FileSystemGlobbing": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "IUQet3SY51xIFcFZKtAB6a54/Zdxs7T3SQ84kJtOD6yeXfZgiOMksACWD5qtTmXGQGFH4QYGBOT0KIO8Uy/dJw==" - }, - "Microsoft.Extensions.Options": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "VBD+131DpTNCNDfA4kIyKTiCySvJGNhwibdWBSdFRu7GMfXLXcXODkgA+KStKbbhzraLglZWUN4nXyHgW4JIRA==", - "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.8", - "Microsoft.Extensions.Primitives": "10.0.8" - } - }, - "Microsoft.Extensions.Primitives": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "OBPo4nYhMyIbtueoC10CBm6AGAbo/A9IV8QQ/6ryZS7VvmqpGT7hunazeHLxFawRzn3oLOq4jhqhpBX4tfswWQ==" - }, "Microsoft.SourceLink.Common": { "type": "Transitive", "resolved": "10.0.300", "contentHash": "0jlkXaUGjYlWTIVPve5MftjKHnT3SlAtq9BCLV4J9IjdPrxV/+4rMlBSjfr1khG8/GC6KGojjola8E1VvWF0qQ==" }, - "System.Diagnostics.EventLog": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "+Ro7WgIom+BDNH+YhTuZKL6QJ0ctfOpTyfUG/h3aU5KwXt3OaNf0wYWrTvoBUj+34Dy5V8dN9yCco1hAJQ4txw==" - }, "System.IO.Hashing": { "type": "Transitive", "resolved": "10.0.8", "contentHash": "+dJsbPJ3FyUbTZNplFj0RCKePFizmv6ewDV46JE9q/IVH4c3xTCftHfHelLsAKf0jryIPqgMb5GpS0x7TAY3mg==" }, - "System.Security.Cryptography.ProtectedData": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "/ldVgSfImIBp6fLWS7sLH0BnmtFj0ZwGlZo4Xx2q0K3ZhJNDbW45kj2f6zPoC+L+BTINuHdMzTsopuwmkbgcNA==" - }, "vm2.Ulid": { "type": "Project", "dependencies": { - "Microsoft.Extensions.Configuration.Binder": "[10.0.8, )", - "Microsoft.Extensions.Configuration.CommandLine": "[10.0.8, )", - "Microsoft.Extensions.Configuration.EnvironmentVariables": "[10.0.8, )", - "Microsoft.Extensions.Configuration.Json": "[10.0.8, )", - "Microsoft.Extensions.DependencyInjection": "[10.0.8, )", - "Microsoft.Extensions.Logging": "[10.0.8, )", - "Microsoft.Extensions.Logging.Abstractions": "[10.0.8, )", - "Microsoft.Extensions.Logging.Configuration": "[10.0.8, )", - "Microsoft.Extensions.Logging.Console": "[10.0.8, )", - "Microsoft.Extensions.Options.ConfigurationExtensions": "[10.0.8, )", - "Microsoft.Extensions.TimeProvider.Testing": "[10.6.0, )", - "Newtonsoft.Json": "[13.0.4, )", - "System.Configuration.ConfigurationManager": "[10.0.8, )" + "Microsoft.Extensions.TimeProvider.Testing": "[10.6.0, )" } } }, @@ -298,11 +76,6 @@ "type": "Transitive", "resolved": "10.0.8", "contentHash": "0jxyi69frgaqADCnEpHE+f65NoiRTAjfjvNDMOxWV77BumQ56eMDL4ECw29DcJTqwaYJQ92PqDS6y6CiLf7kgw==" - }, - "System.Diagnostics.EventLog": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "+Ro7WgIom+BDNH+YhTuZKL6QJ0ctfOpTyfUG/h3aU5KwXt3OaNf0wYWrTvoBUj+34Dy5V8dN9yCco1hAJQ4txw==" } } } diff --git a/src/UlidType/Serialization/NsJson/UlidNsConverter.cs b/src/UlidNsConverter/UlidNsConverter.cs similarity index 98% rename from src/UlidType/Serialization/NsJson/UlidNsConverter.cs rename to src/UlidNsConverter/UlidNsConverter.cs index 8f44dce..853036a 100644 --- a/src/UlidType/Serialization/NsJson/UlidNsConverter.cs +++ b/src/UlidNsConverter/UlidNsConverter.cs @@ -66,7 +66,7 @@ public override void WriteJson(JsonWriter writer, object? value, JsonSerializer if (reader.TokenType is not JsonToken.String) throw new JsonReaderException($"Expected token type to be {JsonToken.String} or {JsonToken.Null}, but got {reader.TokenType}."); - return Parse(reader.Value.ToString()!); + return vm2.Ulid.Parse(reader.Value.ToString()!); } catch (Exception ex) when (ex is not JsonReaderException) { diff --git a/src/UlidNsConverter/UlidNsConverter.csproj b/src/UlidNsConverter/UlidNsConverter.csproj new file mode 100644 index 0000000..96cc468 --- /dev/null +++ b/src/UlidNsConverter/UlidNsConverter.csproj @@ -0,0 +1,34 @@ + + + + vm2.UlidSerialization.NsJson + false + false + + + + vm2.UlidSerialization.NsJson + Companion package: Newtonsoft.Json converter for vm2.Ulid + Provides a Newtonsoft.Json converter for the ULID-s from vm2.Ulid. + ULID Universally Unique Lexicographically Sortable Identifier .net core vm2 Newtonsoft JSON converter + https://github.com/vmelamed/vm2.Ulid/blob/main/src/UlidNsConverter/UlidNsConverter.csproj + https://github.com/vmelamed/vm2.Ulid + README.md + Initial release: split from vm2.Ulid. This package is not AoT compatible because it depends on Newtonsoft.Json. + + + + + + + + + + + + + + + + + diff --git a/src/UlidNsConverter/packages.lock.json b/src/UlidNsConverter/packages.lock.json new file mode 100644 index 0000000..3b5ec32 --- /dev/null +++ b/src/UlidNsConverter/packages.lock.json @@ -0,0 +1,60 @@ +{ + "version": 2, + "dependencies": { + "net10.0": { + "Microsoft.Extensions.TimeProvider.Testing": { + "type": "Direct", + "requested": "[10.6.0, )", + "resolved": "10.6.0", + "contentHash": "qQDiaYWpvIymGbu+kXaMDS8YdqfeQkv6DOxPF2GSwC+eSzIKqOOnSP34TYt7gKqvB7p8/aSptexnW6nF0CUdnw==" + }, + "Microsoft.SourceLink.GitHub": { + "type": "Direct", + "requested": "[10.0.300, )", + "resolved": "10.0.300", + "contentHash": "QzCtLkXVb3l4IxcpvJCbzUwMLihAmLN6vVLjQGSzYSF8d2dvXxqJAZk83RV3gYnp2egz8jRMgSR2woY3vOahTA==", + "dependencies": { + "Microsoft.Build.Tasks.Git": "10.0.300", + "Microsoft.SourceLink.Common": "10.0.300", + "System.IO.Hashing": "10.0.8" + } + }, + "MinVer": { + "type": "Direct", + "requested": "[7.0.0, )", + "resolved": "7.0.0", + "contentHash": "2lMTCQl5bGP4iv0JNkockPnyllC6eHLz+CoK2ICvalvHod+exXSxueu9hq+zNkU7bZBJf8wMfeRC/Edn8AGmEg==" + }, + "Newtonsoft.Json": { + "type": "Direct", + "requested": "[13.0.4, )", + "resolved": "13.0.4", + "contentHash": "pdgNNMai3zv51W5aq268sujXUyx7SNdE2bj1wZcWjAQrKMFZV260lbqYop1d2GM67JI1huLRwxo9ZqnfF/lC6A==" + }, + "Microsoft.Build.Tasks.Git": { + "type": "Transitive", + "resolved": "10.0.300", + "contentHash": "P0kaQwVZx4xIUe2FtrLyBadYNXuAljttJUPvjBYRuHhPE8L77L42KakLDkaADRiUrGspoLcMwayjrbQhYTr0zA==", + "dependencies": { + "System.IO.Hashing": "10.0.8" + } + }, + "Microsoft.SourceLink.Common": { + "type": "Transitive", + "resolved": "10.0.300", + "contentHash": "0jlkXaUGjYlWTIVPve5MftjKHnT3SlAtq9BCLV4J9IjdPrxV/+4rMlBSjfr1khG8/GC6KGojjola8E1VvWF0qQ==" + }, + "System.IO.Hashing": { + "type": "Transitive", + "resolved": "10.0.8", + "contentHash": "+dJsbPJ3FyUbTZNplFj0RCKePFizmv6ewDV46JE9q/IVH4c3xTCftHfHelLsAKf0jryIPqgMb5GpS0x7TAY3mg==" + }, + "vm2.Ulid": { + "type": "Project", + "dependencies": { + "Microsoft.Extensions.TimeProvider.Testing": "[10.6.0, )" + } + } + } + } +} \ No newline at end of file diff --git a/src/UlidTool/UlidTool.csproj b/src/UlidTool/UlidTool.csproj index d44029a..3e04a6a 100644 --- a/src/UlidTool/UlidTool.csproj +++ b/src/UlidTool/UlidTool.csproj @@ -3,6 +3,8 @@ Exe vm2.UlidTool + false + false true ulid diff --git a/src/UlidTool/packages.lock.json b/src/UlidTool/packages.lock.json index 4c6d96f..cb9f52e 100644 --- a/src/UlidTool/packages.lock.json +++ b/src/UlidTool/packages.lock.json @@ -2,131 +2,12 @@ "version": 2, "dependencies": { "net10.0": { - "Microsoft.Extensions.Configuration.Binder": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "R3NN1X+kVu14uoxLEW6sBSQyhogDSbaOQzILnCtuXxBN4hx22AgjWPwZX6v/suERFkEDgU1lk12AglHTrUxhlw==", - "dependencies": { - "Microsoft.Extensions.Configuration": "10.0.8", - "Microsoft.Extensions.Configuration.Abstractions": "10.0.8" - } - }, - "Microsoft.Extensions.Configuration.CommandLine": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "nQXq1a4MiInYh+0VF9fguxAl06q2ftmOyYQ+5e933s4rk57xjgkbTjUdFUySzjrcrvDeWsSqlZB+TE8+TbM2HA==", - "dependencies": { - "Microsoft.Extensions.Configuration": "10.0.8", - "Microsoft.Extensions.Configuration.Abstractions": "10.0.8" - } - }, - "Microsoft.Extensions.Configuration.EnvironmentVariables": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "bVGqctAfPGfTxJvNp8pMshtvpsUj6r6JkeiCNVIGVYO5gBxuxdN0Lbr25kEvE/zXdctkEc44g8HssnPgDnFGVA==", - "dependencies": { - "Microsoft.Extensions.Configuration": "10.0.8", - "Microsoft.Extensions.Configuration.Abstractions": "10.0.8" - } - }, - "Microsoft.Extensions.Configuration.Json": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "KLtAZ6A38s1pIfCO2ns6aG14NNGMYNZ4PBYfFK4M+R4A+xuSc6oklhqDcpHZxvDpyBWeFtR5C8iQBw2ng8tUHQ==", - "dependencies": { - "Microsoft.Extensions.Configuration": "10.0.8", - "Microsoft.Extensions.Configuration.Abstractions": "10.0.8", - "Microsoft.Extensions.Configuration.FileExtensions": "10.0.8", - "Microsoft.Extensions.FileProviders.Abstractions": "10.0.8" - } - }, - "Microsoft.Extensions.DependencyInjection": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "daf62xHIrq8pnE709hgaZZN9tSam9TGGepWe1+bE6V3GEuVwJiMs6ib+38lfMCyAJAHiX0vapxBhsuMSV7U+cg==", - "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.8" - } - }, - "Microsoft.Extensions.Logging": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "K60JhWC2hN/Gi7TP68tBxSzk5ACWOs7lkmPzsfA8Bcf/IXTajujt2ORMf9rSMk1bsng6Lv4Y3fuxp3bm1+15ug==", - "dependencies": { - "Microsoft.Extensions.DependencyInjection": "10.0.8", - "Microsoft.Extensions.Logging.Abstractions": "10.0.8", - "Microsoft.Extensions.Options": "10.0.8" - } - }, - "Microsoft.Extensions.Logging.Abstractions": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "fdVadZmsC8jRP0KvKy8mO8f6GV/HyBvElfcSxEhd+5FM5boAw/01iSaCto5G3G37ApJira4A3pNaVvBv8cUiLQ==", - "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.8" - } - }, - "Microsoft.Extensions.Logging.Configuration": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "rxSLTO7xTbcC3DuEJHNEijBr8g14Jj62zQ+DeFu68bsoTYoU8jLcMhc1735PV21bESXsATlL5LsfaWH71FOWAg==", - "dependencies": { - "Microsoft.Extensions.Configuration": "10.0.8", - "Microsoft.Extensions.Configuration.Abstractions": "10.0.8", - "Microsoft.Extensions.Configuration.Binder": "10.0.8", - "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.8", - "Microsoft.Extensions.Logging": "10.0.8", - "Microsoft.Extensions.Logging.Abstractions": "10.0.8", - "Microsoft.Extensions.Options": "10.0.8", - "Microsoft.Extensions.Options.ConfigurationExtensions": "10.0.8" - } - }, - "Microsoft.Extensions.Logging.Console": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "6cv53sHsPnFS56PJw8X4GbNcjeX1KGyFJRxJWvxOgK63cnqeSB1k1eRwjUdkse0tBhwlH6qc9EOYDlan+CYTuw==", - "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.8", - "Microsoft.Extensions.Logging": "10.0.8", - "Microsoft.Extensions.Logging.Abstractions": "10.0.8", - "Microsoft.Extensions.Logging.Configuration": "10.0.8", - "Microsoft.Extensions.Options": "10.0.8" - } - }, - "Microsoft.Extensions.Options.ConfigurationExtensions": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "VOapXeO3lhBH0zYoyAH7tjapuo4V5pTHlevPpiSHueEquAajqd5nF0mttm+h/uE/exwAEuM5s26SzOJtletE3w==", - "dependencies": { - "Microsoft.Extensions.Configuration.Abstractions": "10.0.8", - "Microsoft.Extensions.Configuration.Binder": "10.0.8", - "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.8", - "Microsoft.Extensions.Options": "10.0.8", - "Microsoft.Extensions.Primitives": "10.0.8" - } - }, "Microsoft.Extensions.TimeProvider.Testing": { "type": "Direct", "requested": "[10.6.0, )", "resolved": "10.6.0", "contentHash": "qQDiaYWpvIymGbu+kXaMDS8YdqfeQkv6DOxPF2GSwC+eSzIKqOOnSP34TYt7gKqvB7p8/aSptexnW6nF0CUdnw==" }, - "Microsoft.NET.ILLink.Tasks": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "dVbSXGIFNR5nZcv2tOLoWI+a9T4jtFd77IYjuND+QVe360qWgAF7H0WtoopYhRw/+SgpGUTyrkrh+65+ClNnfw==" - }, "Microsoft.SourceLink.GitHub": { "type": "Direct", "requested": "[10.0.300, )", @@ -144,28 +25,12 @@ "resolved": "7.0.0", "contentHash": "2lMTCQl5bGP4iv0JNkockPnyllC6eHLz+CoK2ICvalvHod+exXSxueu9hq+zNkU7bZBJf8wMfeRC/Edn8AGmEg==" }, - "Newtonsoft.Json": { - "type": "Direct", - "requested": "[13.0.4, )", - "resolved": "13.0.4", - "contentHash": "pdgNNMai3zv51W5aq268sujXUyx7SNdE2bj1wZcWjAQrKMFZV260lbqYop1d2GM67JI1huLRwxo9ZqnfF/lC6A==" - }, "System.CommandLine": { "type": "Direct", "requested": "[2.0.8, )", "resolved": "2.0.8", "contentHash": "FbpgF8p/ClXnoXEWLjQB34kNh5rsLewEgIgLyVzLDucAOQ4cNs7ec9Cam7gdKPruSb6zp4Mx8htZGTL4/5PJPg==" }, - "System.Configuration.ConfigurationManager": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "QG+HHwJjLyUiRuA9axr5pDqHAxboo7FXCTRakxMABE9CUAUij/tsd/MsgQPJUEppkf+YBLT+F/P/wKIVCAIcNg==", - "dependencies": { - "System.Diagnostics.EventLog": "10.0.8", - "System.Security.Cryptography.ProtectedData": "10.0.8" - } - }, "Microsoft.Build.Tasks.Git": { "type": "Transitive", "resolved": "10.0.300", @@ -174,113 +39,20 @@ "System.IO.Hashing": "10.0.8" } }, - "Microsoft.Extensions.Configuration": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "ehZcoPbjzWzS4XFvuz7R3V55SmpdkyMqFURLH3yXaN9NtXd9tR6CGB7pd49HYtCkenl+G7ctXSFLhNI08xLfRg==", - "dependencies": { - "Microsoft.Extensions.Configuration.Abstractions": "10.0.8", - "Microsoft.Extensions.Primitives": "10.0.8" - } - }, - "Microsoft.Extensions.Configuration.Abstractions": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "I63esIFbL3h5pSt7gXpXOlmcwDmYBUoYNEglKfDPFUqtYvSV84f2l28hO2lfVXsV0wdlplgAM7IVz16matapSg==", - "dependencies": { - "Microsoft.Extensions.Primitives": "10.0.8" - } - }, - "Microsoft.Extensions.Configuration.FileExtensions": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "1g9mzuu8gIHkjYb0jLxOTQVl/QDG5nn0b0JzgT/gbgNKr6gXZzxOHRAsdYRc1eDApB7LdHR8uK5vQrNjIQdRrQ==", - "dependencies": { - "Microsoft.Extensions.Configuration": "10.0.8", - "Microsoft.Extensions.Configuration.Abstractions": "10.0.8", - "Microsoft.Extensions.FileProviders.Abstractions": "10.0.8", - "Microsoft.Extensions.FileProviders.Physical": "10.0.8", - "Microsoft.Extensions.Primitives": "10.0.8" - } - }, - "Microsoft.Extensions.DependencyInjection.Abstractions": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "21nbDV60SRPWGIivsyl6lqBeEJNG1sginhhfWgRrr3Ais7aQ12To25OAHQxgoiJkjqy1aQ6RxpZBGYuTi7Ge6A==" - }, - "Microsoft.Extensions.FileProviders.Abstractions": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "U+oquaPxFdY8lYeEIWO/AD7jDIl9sPW6aVWMQRHU/pZ/SWpLcOrAj2fcLe1HwXl4sYw1ONI56K/eELT3xr4RRQ==", - "dependencies": { - "Microsoft.Extensions.Primitives": "10.0.8" - } - }, - "Microsoft.Extensions.FileProviders.Physical": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "GkPvQe6IdidLu6Q3Lw6+B8NJpW8feW8czZ5mBKt5rXM/x8MvZfEp5WvAsjznzDGd23chIDrW0b2mmt+ScnEgiw==", - "dependencies": { - "Microsoft.Extensions.FileProviders.Abstractions": "10.0.8", - "Microsoft.Extensions.FileSystemGlobbing": "10.0.8", - "Microsoft.Extensions.Primitives": "10.0.8" - } - }, - "Microsoft.Extensions.FileSystemGlobbing": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "IUQet3SY51xIFcFZKtAB6a54/Zdxs7T3SQ84kJtOD6yeXfZgiOMksACWD5qtTmXGQGFH4QYGBOT0KIO8Uy/dJw==" - }, - "Microsoft.Extensions.Options": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "VBD+131DpTNCNDfA4kIyKTiCySvJGNhwibdWBSdFRu7GMfXLXcXODkgA+KStKbbhzraLglZWUN4nXyHgW4JIRA==", - "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.8", - "Microsoft.Extensions.Primitives": "10.0.8" - } - }, - "Microsoft.Extensions.Primitives": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "OBPo4nYhMyIbtueoC10CBm6AGAbo/A9IV8QQ/6ryZS7VvmqpGT7hunazeHLxFawRzn3oLOq4jhqhpBX4tfswWQ==" - }, "Microsoft.SourceLink.Common": { "type": "Transitive", "resolved": "10.0.300", "contentHash": "0jlkXaUGjYlWTIVPve5MftjKHnT3SlAtq9BCLV4J9IjdPrxV/+4rMlBSjfr1khG8/GC6KGojjola8E1VvWF0qQ==" }, - "System.Diagnostics.EventLog": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "+Ro7WgIom+BDNH+YhTuZKL6QJ0ctfOpTyfUG/h3aU5KwXt3OaNf0wYWrTvoBUj+34Dy5V8dN9yCco1hAJQ4txw==" - }, "System.IO.Hashing": { "type": "Transitive", "resolved": "10.0.8", "contentHash": "+dJsbPJ3FyUbTZNplFj0RCKePFizmv6ewDV46JE9q/IVH4c3xTCftHfHelLsAKf0jryIPqgMb5GpS0x7TAY3mg==" }, - "System.Security.Cryptography.ProtectedData": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "/ldVgSfImIBp6fLWS7sLH0BnmtFj0ZwGlZo4Xx2q0K3ZhJNDbW45kj2f6zPoC+L+BTINuHdMzTsopuwmkbgcNA==" - }, "vm2.Ulid": { "type": "Project", "dependencies": { - "Microsoft.Extensions.Configuration.Binder": "[10.0.8, )", - "Microsoft.Extensions.Configuration.CommandLine": "[10.0.8, )", - "Microsoft.Extensions.Configuration.EnvironmentVariables": "[10.0.8, )", - "Microsoft.Extensions.Configuration.Json": "[10.0.8, )", - "Microsoft.Extensions.DependencyInjection": "[10.0.8, )", - "Microsoft.Extensions.Logging": "[10.0.8, )", - "Microsoft.Extensions.Logging.Abstractions": "[10.0.8, )", - "Microsoft.Extensions.Logging.Configuration": "[10.0.8, )", - "Microsoft.Extensions.Logging.Console": "[10.0.8, )", - "Microsoft.Extensions.Options.ConfigurationExtensions": "[10.0.8, )", - "Microsoft.Extensions.TimeProvider.Testing": "[10.6.0, )", - "Newtonsoft.Json": "[13.0.4, )", - "System.Configuration.ConfigurationManager": "[10.0.8, )" + "Microsoft.Extensions.TimeProvider.Testing": "[10.6.0, )" } } } diff --git a/src/UlidType/Ulid.cs b/src/UlidType/Ulid.cs index 317a5fc..cc446b9 100644 --- a/src/UlidType/Ulid.cs +++ b/src/UlidType/Ulid.cs @@ -11,7 +11,6 @@ namespace vm2; /// order. This struct provides methods for creating, parsing, and manipulating ULIDs, as well as converting them to other formats
/// such as strings or GUIDs. ULIDs are commonly used in distributed systems where unique, sortable identifiers are required. /// -[Newtonsoft.Json.JsonConverter(typeof(UlidNsConverter))] [System.Text.Json.Serialization.JsonConverter(typeof(UlidSysConverter))] public readonly partial struct Ulid : IEquatable, diff --git a/src/UlidType/packages.lock.json b/src/UlidType/packages.lock.json index 6a5c39a..7349e48 100644 --- a/src/UlidType/packages.lock.json +++ b/src/UlidType/packages.lock.json @@ -2,119 +2,6 @@ "version": 2, "dependencies": { "net10.0": { - "Microsoft.Extensions.Configuration.Binder": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "R3NN1X+kVu14uoxLEW6sBSQyhogDSbaOQzILnCtuXxBN4hx22AgjWPwZX6v/suERFkEDgU1lk12AglHTrUxhlw==", - "dependencies": { - "Microsoft.Extensions.Configuration": "10.0.8", - "Microsoft.Extensions.Configuration.Abstractions": "10.0.8" - } - }, - "Microsoft.Extensions.Configuration.CommandLine": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "nQXq1a4MiInYh+0VF9fguxAl06q2ftmOyYQ+5e933s4rk57xjgkbTjUdFUySzjrcrvDeWsSqlZB+TE8+TbM2HA==", - "dependencies": { - "Microsoft.Extensions.Configuration": "10.0.8", - "Microsoft.Extensions.Configuration.Abstractions": "10.0.8" - } - }, - "Microsoft.Extensions.Configuration.EnvironmentVariables": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "bVGqctAfPGfTxJvNp8pMshtvpsUj6r6JkeiCNVIGVYO5gBxuxdN0Lbr25kEvE/zXdctkEc44g8HssnPgDnFGVA==", - "dependencies": { - "Microsoft.Extensions.Configuration": "10.0.8", - "Microsoft.Extensions.Configuration.Abstractions": "10.0.8" - } - }, - "Microsoft.Extensions.Configuration.Json": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "KLtAZ6A38s1pIfCO2ns6aG14NNGMYNZ4PBYfFK4M+R4A+xuSc6oklhqDcpHZxvDpyBWeFtR5C8iQBw2ng8tUHQ==", - "dependencies": { - "Microsoft.Extensions.Configuration": "10.0.8", - "Microsoft.Extensions.Configuration.Abstractions": "10.0.8", - "Microsoft.Extensions.Configuration.FileExtensions": "10.0.8", - "Microsoft.Extensions.FileProviders.Abstractions": "10.0.8" - } - }, - "Microsoft.Extensions.DependencyInjection": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "daf62xHIrq8pnE709hgaZZN9tSam9TGGepWe1+bE6V3GEuVwJiMs6ib+38lfMCyAJAHiX0vapxBhsuMSV7U+cg==", - "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.8" - } - }, - "Microsoft.Extensions.Logging": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "K60JhWC2hN/Gi7TP68tBxSzk5ACWOs7lkmPzsfA8Bcf/IXTajujt2ORMf9rSMk1bsng6Lv4Y3fuxp3bm1+15ug==", - "dependencies": { - "Microsoft.Extensions.DependencyInjection": "10.0.8", - "Microsoft.Extensions.Logging.Abstractions": "10.0.8", - "Microsoft.Extensions.Options": "10.0.8" - } - }, - "Microsoft.Extensions.Logging.Abstractions": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "fdVadZmsC8jRP0KvKy8mO8f6GV/HyBvElfcSxEhd+5FM5boAw/01iSaCto5G3G37ApJira4A3pNaVvBv8cUiLQ==", - "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.8" - } - }, - "Microsoft.Extensions.Logging.Configuration": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "rxSLTO7xTbcC3DuEJHNEijBr8g14Jj62zQ+DeFu68bsoTYoU8jLcMhc1735PV21bESXsATlL5LsfaWH71FOWAg==", - "dependencies": { - "Microsoft.Extensions.Configuration": "10.0.8", - "Microsoft.Extensions.Configuration.Abstractions": "10.0.8", - "Microsoft.Extensions.Configuration.Binder": "10.0.8", - "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.8", - "Microsoft.Extensions.Logging": "10.0.8", - "Microsoft.Extensions.Logging.Abstractions": "10.0.8", - "Microsoft.Extensions.Options": "10.0.8", - "Microsoft.Extensions.Options.ConfigurationExtensions": "10.0.8" - } - }, - "Microsoft.Extensions.Logging.Console": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "6cv53sHsPnFS56PJw8X4GbNcjeX1KGyFJRxJWvxOgK63cnqeSB1k1eRwjUdkse0tBhwlH6qc9EOYDlan+CYTuw==", - "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.8", - "Microsoft.Extensions.Logging": "10.0.8", - "Microsoft.Extensions.Logging.Abstractions": "10.0.8", - "Microsoft.Extensions.Logging.Configuration": "10.0.8", - "Microsoft.Extensions.Options": "10.0.8" - } - }, - "Microsoft.Extensions.Options.ConfigurationExtensions": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "VOapXeO3lhBH0zYoyAH7tjapuo4V5pTHlevPpiSHueEquAajqd5nF0mttm+h/uE/exwAEuM5s26SzOJtletE3w==", - "dependencies": { - "Microsoft.Extensions.Configuration.Abstractions": "10.0.8", - "Microsoft.Extensions.Configuration.Binder": "10.0.8", - "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.8", - "Microsoft.Extensions.Options": "10.0.8", - "Microsoft.Extensions.Primitives": "10.0.8" - } - }, "Microsoft.Extensions.TimeProvider.Testing": { "type": "Direct", "requested": "[10.6.0, )", @@ -144,22 +31,6 @@ "resolved": "7.0.0", "contentHash": "2lMTCQl5bGP4iv0JNkockPnyllC6eHLz+CoK2ICvalvHod+exXSxueu9hq+zNkU7bZBJf8wMfeRC/Edn8AGmEg==" }, - "Newtonsoft.Json": { - "type": "Direct", - "requested": "[13.0.4, )", - "resolved": "13.0.4", - "contentHash": "pdgNNMai3zv51W5aq268sujXUyx7SNdE2bj1wZcWjAQrKMFZV260lbqYop1d2GM67JI1huLRwxo9ZqnfF/lC6A==" - }, - "System.Configuration.ConfigurationManager": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "QG+HHwJjLyUiRuA9axr5pDqHAxboo7FXCTRakxMABE9CUAUij/tsd/MsgQPJUEppkf+YBLT+F/P/wKIVCAIcNg==", - "dependencies": { - "System.Diagnostics.EventLog": "10.0.8", - "System.Security.Cryptography.ProtectedData": "10.0.8" - } - }, "Microsoft.Build.Tasks.Git": { "type": "Transitive", "resolved": "10.0.300", @@ -168,96 +39,15 @@ "System.IO.Hashing": "10.0.8" } }, - "Microsoft.Extensions.Configuration": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "ehZcoPbjzWzS4XFvuz7R3V55SmpdkyMqFURLH3yXaN9NtXd9tR6CGB7pd49HYtCkenl+G7ctXSFLhNI08xLfRg==", - "dependencies": { - "Microsoft.Extensions.Configuration.Abstractions": "10.0.8", - "Microsoft.Extensions.Primitives": "10.0.8" - } - }, - "Microsoft.Extensions.Configuration.Abstractions": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "I63esIFbL3h5pSt7gXpXOlmcwDmYBUoYNEglKfDPFUqtYvSV84f2l28hO2lfVXsV0wdlplgAM7IVz16matapSg==", - "dependencies": { - "Microsoft.Extensions.Primitives": "10.0.8" - } - }, - "Microsoft.Extensions.Configuration.FileExtensions": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "1g9mzuu8gIHkjYb0jLxOTQVl/QDG5nn0b0JzgT/gbgNKr6gXZzxOHRAsdYRc1eDApB7LdHR8uK5vQrNjIQdRrQ==", - "dependencies": { - "Microsoft.Extensions.Configuration": "10.0.8", - "Microsoft.Extensions.Configuration.Abstractions": "10.0.8", - "Microsoft.Extensions.FileProviders.Abstractions": "10.0.8", - "Microsoft.Extensions.FileProviders.Physical": "10.0.8", - "Microsoft.Extensions.Primitives": "10.0.8" - } - }, - "Microsoft.Extensions.DependencyInjection.Abstractions": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "21nbDV60SRPWGIivsyl6lqBeEJNG1sginhhfWgRrr3Ais7aQ12To25OAHQxgoiJkjqy1aQ6RxpZBGYuTi7Ge6A==" - }, - "Microsoft.Extensions.FileProviders.Abstractions": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "U+oquaPxFdY8lYeEIWO/AD7jDIl9sPW6aVWMQRHU/pZ/SWpLcOrAj2fcLe1HwXl4sYw1ONI56K/eELT3xr4RRQ==", - "dependencies": { - "Microsoft.Extensions.Primitives": "10.0.8" - } - }, - "Microsoft.Extensions.FileProviders.Physical": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "GkPvQe6IdidLu6Q3Lw6+B8NJpW8feW8czZ5mBKt5rXM/x8MvZfEp5WvAsjznzDGd23chIDrW0b2mmt+ScnEgiw==", - "dependencies": { - "Microsoft.Extensions.FileProviders.Abstractions": "10.0.8", - "Microsoft.Extensions.FileSystemGlobbing": "10.0.8", - "Microsoft.Extensions.Primitives": "10.0.8" - } - }, - "Microsoft.Extensions.FileSystemGlobbing": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "IUQet3SY51xIFcFZKtAB6a54/Zdxs7T3SQ84kJtOD6yeXfZgiOMksACWD5qtTmXGQGFH4QYGBOT0KIO8Uy/dJw==" - }, - "Microsoft.Extensions.Options": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "VBD+131DpTNCNDfA4kIyKTiCySvJGNhwibdWBSdFRu7GMfXLXcXODkgA+KStKbbhzraLglZWUN4nXyHgW4JIRA==", - "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.8", - "Microsoft.Extensions.Primitives": "10.0.8" - } - }, - "Microsoft.Extensions.Primitives": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "OBPo4nYhMyIbtueoC10CBm6AGAbo/A9IV8QQ/6ryZS7VvmqpGT7hunazeHLxFawRzn3oLOq4jhqhpBX4tfswWQ==" - }, "Microsoft.SourceLink.Common": { "type": "Transitive", "resolved": "10.0.300", "contentHash": "0jlkXaUGjYlWTIVPve5MftjKHnT3SlAtq9BCLV4J9IjdPrxV/+4rMlBSjfr1khG8/GC6KGojjola8E1VvWF0qQ==" }, - "System.Diagnostics.EventLog": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "+Ro7WgIom+BDNH+YhTuZKL6QJ0ctfOpTyfUG/h3aU5KwXt3OaNf0wYWrTvoBUj+34Dy5V8dN9yCco1hAJQ4txw==" - }, "System.IO.Hashing": { "type": "Transitive", "resolved": "10.0.8", "contentHash": "+dJsbPJ3FyUbTZNplFj0RCKePFizmv6ewDV46JE9q/IVH4c3xTCftHfHelLsAKf0jryIPqgMb5GpS0x7TAY3mg==" - }, - "System.Security.Cryptography.ProtectedData": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "/ldVgSfImIBp6fLWS7sLH0BnmtFj0ZwGlZo4Xx2q0K3ZhJNDbW45kj2f6zPoC+L+BTINuHdMzTsopuwmkbgcNA==" } } } diff --git a/src/UlidType/usings.cs b/src/UlidType/usings.cs index d7f39f0..951c2cc 100644 --- a/src/UlidType/usings.cs +++ b/src/UlidType/usings.cs @@ -7,12 +7,8 @@ global using System.Numerics; global using System.Security.Cryptography; global using System.Text.Json; -global using System.Runtime.Serialization; -global using static System.Buffers.Binary.BinaryPrimitives; - -global using vm2; -global using vm2.UlidSerialization.NsJson; global using vm2.UlidSerialization.SysJson; +global using static System.Buffers.Binary.BinaryPrimitives; global using static vm2.Ulid; diff --git a/test/UlidTool.Tests/packages.lock.json b/test/UlidTool.Tests/packages.lock.json index 1b83171..f22ae3b 100644 --- a/test/UlidTool.Tests/packages.lock.json +++ b/test/UlidTool.Tests/packages.lock.json @@ -8,131 +8,12 @@ "resolved": "8.10.0", "contentHash": "yGvv+xp0gHFgGwhQcGoDdKIrhLhPi3zYYWWLLHPMctr+G6PWD7QH8L4wqoa5WRZquPbfSV/cP1MraI7ppAHrWw==" }, - "Microsoft.Extensions.Configuration.Binder": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "R3NN1X+kVu14uoxLEW6sBSQyhogDSbaOQzILnCtuXxBN4hx22AgjWPwZX6v/suERFkEDgU1lk12AglHTrUxhlw==", - "dependencies": { - "Microsoft.Extensions.Configuration": "10.0.8", - "Microsoft.Extensions.Configuration.Abstractions": "10.0.8" - } - }, - "Microsoft.Extensions.Configuration.CommandLine": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "nQXq1a4MiInYh+0VF9fguxAl06q2ftmOyYQ+5e933s4rk57xjgkbTjUdFUySzjrcrvDeWsSqlZB+TE8+TbM2HA==", - "dependencies": { - "Microsoft.Extensions.Configuration": "10.0.8", - "Microsoft.Extensions.Configuration.Abstractions": "10.0.8" - } - }, - "Microsoft.Extensions.Configuration.EnvironmentVariables": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "bVGqctAfPGfTxJvNp8pMshtvpsUj6r6JkeiCNVIGVYO5gBxuxdN0Lbr25kEvE/zXdctkEc44g8HssnPgDnFGVA==", - "dependencies": { - "Microsoft.Extensions.Configuration": "10.0.8", - "Microsoft.Extensions.Configuration.Abstractions": "10.0.8" - } - }, - "Microsoft.Extensions.Configuration.Json": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "KLtAZ6A38s1pIfCO2ns6aG14NNGMYNZ4PBYfFK4M+R4A+xuSc6oklhqDcpHZxvDpyBWeFtR5C8iQBw2ng8tUHQ==", - "dependencies": { - "Microsoft.Extensions.Configuration": "10.0.8", - "Microsoft.Extensions.Configuration.Abstractions": "10.0.8", - "Microsoft.Extensions.Configuration.FileExtensions": "10.0.8", - "Microsoft.Extensions.FileProviders.Abstractions": "10.0.8" - } - }, - "Microsoft.Extensions.DependencyInjection": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "daf62xHIrq8pnE709hgaZZN9tSam9TGGepWe1+bE6V3GEuVwJiMs6ib+38lfMCyAJAHiX0vapxBhsuMSV7U+cg==", - "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.8" - } - }, - "Microsoft.Extensions.Logging": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "K60JhWC2hN/Gi7TP68tBxSzk5ACWOs7lkmPzsfA8Bcf/IXTajujt2ORMf9rSMk1bsng6Lv4Y3fuxp3bm1+15ug==", - "dependencies": { - "Microsoft.Extensions.DependencyInjection": "10.0.8", - "Microsoft.Extensions.Logging.Abstractions": "10.0.8", - "Microsoft.Extensions.Options": "10.0.8" - } - }, - "Microsoft.Extensions.Logging.Abstractions": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "fdVadZmsC8jRP0KvKy8mO8f6GV/HyBvElfcSxEhd+5FM5boAw/01iSaCto5G3G37ApJira4A3pNaVvBv8cUiLQ==", - "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.8" - } - }, - "Microsoft.Extensions.Logging.Configuration": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "rxSLTO7xTbcC3DuEJHNEijBr8g14Jj62zQ+DeFu68bsoTYoU8jLcMhc1735PV21bESXsATlL5LsfaWH71FOWAg==", - "dependencies": { - "Microsoft.Extensions.Configuration": "10.0.8", - "Microsoft.Extensions.Configuration.Abstractions": "10.0.8", - "Microsoft.Extensions.Configuration.Binder": "10.0.8", - "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.8", - "Microsoft.Extensions.Logging": "10.0.8", - "Microsoft.Extensions.Logging.Abstractions": "10.0.8", - "Microsoft.Extensions.Options": "10.0.8", - "Microsoft.Extensions.Options.ConfigurationExtensions": "10.0.8" - } - }, - "Microsoft.Extensions.Logging.Console": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "6cv53sHsPnFS56PJw8X4GbNcjeX1KGyFJRxJWvxOgK63cnqeSB1k1eRwjUdkse0tBhwlH6qc9EOYDlan+CYTuw==", - "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.8", - "Microsoft.Extensions.Logging": "10.0.8", - "Microsoft.Extensions.Logging.Abstractions": "10.0.8", - "Microsoft.Extensions.Logging.Configuration": "10.0.8", - "Microsoft.Extensions.Options": "10.0.8" - } - }, - "Microsoft.Extensions.Options.ConfigurationExtensions": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "VOapXeO3lhBH0zYoyAH7tjapuo4V5pTHlevPpiSHueEquAajqd5nF0mttm+h/uE/exwAEuM5s26SzOJtletE3w==", - "dependencies": { - "Microsoft.Extensions.Configuration.Abstractions": "10.0.8", - "Microsoft.Extensions.Configuration.Binder": "10.0.8", - "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.8", - "Microsoft.Extensions.Options": "10.0.8", - "Microsoft.Extensions.Primitives": "10.0.8" - } - }, "Microsoft.Extensions.TimeProvider.Testing": { "type": "Direct", "requested": "[10.6.0, )", "resolved": "10.6.0", "contentHash": "qQDiaYWpvIymGbu+kXaMDS8YdqfeQkv6DOxPF2GSwC+eSzIKqOOnSP34TYt7gKqvB7p8/aSptexnW6nF0CUdnw==" }, - "Microsoft.NET.ILLink.Tasks": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "dVbSXGIFNR5nZcv2tOLoWI+a9T4jtFd77IYjuND+QVe360qWgAF7H0WtoopYhRw/+SgpGUTyrkrh+65+ClNnfw==" - }, "Microsoft.SourceLink.GitHub": { "type": "Direct", "requested": "[10.0.300, )", @@ -171,12 +52,6 @@ "resolved": "7.0.0", "contentHash": "2lMTCQl5bGP4iv0JNkockPnyllC6eHLz+CoK2ICvalvHod+exXSxueu9hq+zNkU7bZBJf8wMfeRC/Edn8AGmEg==" }, - "Newtonsoft.Json": { - "type": "Direct", - "requested": "[13.0.4, )", - "resolved": "13.0.4", - "contentHash": "pdgNNMai3zv51W5aq268sujXUyx7SNdE2bj1wZcWjAQrKMFZV260lbqYop1d2GM67JI1huLRwxo9ZqnfF/lC6A==" - }, "NSubstitute": { "type": "Direct", "requested": "[5.3.0, )", @@ -186,34 +61,14 @@ "Castle.Core": "5.1.1" } }, - "System.Configuration.ConfigurationManager": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "QG+HHwJjLyUiRuA9axr5pDqHAxboo7FXCTRakxMABE9CUAUij/tsd/MsgQPJUEppkf+YBLT+F/P/wKIVCAIcNg==", - "dependencies": { - "System.Diagnostics.EventLog": "10.0.8", - "System.Security.Cryptography.ProtectedData": "10.0.8" - } - }, "vm2.TestUtilities": { "type": "Direct", - "requested": "[1.5.1, )", - "resolved": "1.5.1", - "contentHash": "ItST5G6Uiu9OIRE3v7azAcBI4Gtst+9WD4NP2kNQL2X1PPwD7a4etGVsQU+ZC9gxvdN3rXb0SlAMSsip5dI40w==", + "requested": "[2.0.1, )", + "resolved": "2.0.1", + "contentHash": "xddArbvLrj2Uyha/RDh3z7/nlbxvlXlu+J/UgFAlZ31AHdYWFINPqrzccIivIfXMk0wgXexEhFaEacv4NIt5IA==", "dependencies": { "FluentAssertions": "8.10.0", - "Microsoft.Extensions.Configuration.Binder": "10.0.8", - "Microsoft.Extensions.Configuration.CommandLine": "10.0.8", - "Microsoft.Extensions.Configuration.EnvironmentVariables": "10.0.8", - "Microsoft.Extensions.Configuration.Json": "10.0.8", - "Microsoft.Extensions.DependencyInjection": "10.0.8", - "Microsoft.Extensions.Logging": "10.0.8", "Microsoft.Extensions.Logging.Abstractions": "10.0.8", - "Microsoft.Extensions.Logging.Configuration": "10.0.8", - "Microsoft.Extensions.Logging.Console": "10.0.8", - "Microsoft.Extensions.Options.ConfigurationExtensions": "10.0.8", - "System.Configuration.ConfigurationManager": "10.0.8", "xunit.v3.extensibility.core": "3.2.2" } }, @@ -259,35 +114,6 @@ "resolved": "2.2.6", "contentHash": "UitZ43WYJQYmcuScLEDTR95EGulBwk2R4N2zLBhaka8frXGVioa6Bkcbc5Fib8UkHIdrnN1lyzOublenrfpgxA==" }, - "Microsoft.Extensions.Configuration": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "ehZcoPbjzWzS4XFvuz7R3V55SmpdkyMqFURLH3yXaN9NtXd9tR6CGB7pd49HYtCkenl+G7ctXSFLhNI08xLfRg==", - "dependencies": { - "Microsoft.Extensions.Configuration.Abstractions": "10.0.8", - "Microsoft.Extensions.Primitives": "10.0.8" - } - }, - "Microsoft.Extensions.Configuration.Abstractions": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "I63esIFbL3h5pSt7gXpXOlmcwDmYBUoYNEglKfDPFUqtYvSV84f2l28hO2lfVXsV0wdlplgAM7IVz16matapSg==", - "dependencies": { - "Microsoft.Extensions.Primitives": "10.0.8" - } - }, - "Microsoft.Extensions.Configuration.FileExtensions": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "1g9mzuu8gIHkjYb0jLxOTQVl/QDG5nn0b0JzgT/gbgNKr6gXZzxOHRAsdYRc1eDApB7LdHR8uK5vQrNjIQdRrQ==", - "dependencies": { - "Microsoft.Extensions.Configuration": "10.0.8", - "Microsoft.Extensions.Configuration.Abstractions": "10.0.8", - "Microsoft.Extensions.FileProviders.Abstractions": "10.0.8", - "Microsoft.Extensions.FileProviders.Physical": "10.0.8", - "Microsoft.Extensions.Primitives": "10.0.8" - } - }, "Microsoft.Extensions.DependencyInjection.Abstractions": { "type": "Transitive", "resolved": "10.0.8", @@ -298,43 +124,14 @@ "resolved": "8.0.2", "contentHash": "mUBDZZRgZrSyFOsJ2qJJ9fXfqd/kXJwf3AiDoqLD9m6TjY5OO/vLNOb9fb4juC0487eq4hcGN/M2Rh/CKS7QYw==" }, - "Microsoft.Extensions.FileProviders.Abstractions": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "U+oquaPxFdY8lYeEIWO/AD7jDIl9sPW6aVWMQRHU/pZ/SWpLcOrAj2fcLe1HwXl4sYw1ONI56K/eELT3xr4RRQ==", - "dependencies": { - "Microsoft.Extensions.Primitives": "10.0.8" - } - }, - "Microsoft.Extensions.FileProviders.Physical": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "GkPvQe6IdidLu6Q3Lw6+B8NJpW8feW8czZ5mBKt5rXM/x8MvZfEp5WvAsjznzDGd23chIDrW0b2mmt+ScnEgiw==", - "dependencies": { - "Microsoft.Extensions.FileProviders.Abstractions": "10.0.8", - "Microsoft.Extensions.FileSystemGlobbing": "10.0.8", - "Microsoft.Extensions.Primitives": "10.0.8" - } - }, - "Microsoft.Extensions.FileSystemGlobbing": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "IUQet3SY51xIFcFZKtAB6a54/Zdxs7T3SQ84kJtOD6yeXfZgiOMksACWD5qtTmXGQGFH4QYGBOT0KIO8Uy/dJw==" - }, - "Microsoft.Extensions.Options": { + "Microsoft.Extensions.Logging.Abstractions": { "type": "Transitive", "resolved": "10.0.8", - "contentHash": "VBD+131DpTNCNDfA4kIyKTiCySvJGNhwibdWBSdFRu7GMfXLXcXODkgA+KStKbbhzraLglZWUN4nXyHgW4JIRA==", + "contentHash": "fdVadZmsC8jRP0KvKy8mO8f6GV/HyBvElfcSxEhd+5FM5boAw/01iSaCto5G3G37ApJira4A3pNaVvBv8cUiLQ==", "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.8", - "Microsoft.Extensions.Primitives": "10.0.8" + "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.8" } }, - "Microsoft.Extensions.Primitives": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "OBPo4nYhMyIbtueoC10CBm6AGAbo/A9IV8QQ/6ryZS7VvmqpGT7hunazeHLxFawRzn3oLOq4jhqhpBX4tfswWQ==" - }, "Microsoft.SourceLink.Common": { "type": "Transitive", "resolved": "10.0.300", @@ -347,19 +144,14 @@ }, "System.Diagnostics.EventLog": { "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "+Ro7WgIom+BDNH+YhTuZKL6QJ0ctfOpTyfUG/h3aU5KwXt3OaNf0wYWrTvoBUj+34Dy5V8dN9yCco1hAJQ4txw==" + "resolved": "6.0.0", + "contentHash": "lcyUiXTsETK2ALsZrX+nWuHSIQeazhqPphLfaRxzdGaG93+0kELqpgEHtwWOlQe7+jSFnKwaCAgL4kjeZCQJnw==" }, "System.IO.Hashing": { "type": "Transitive", "resolved": "10.0.8", "contentHash": "+dJsbPJ3FyUbTZNplFj0RCKePFizmv6ewDV46JE9q/IVH4c3xTCftHfHelLsAKf0jryIPqgMb5GpS0x7TAY3mg==" }, - "System.Security.Cryptography.ProtectedData": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "/ldVgSfImIBp6fLWS7sLH0BnmtFj0ZwGlZo4Xx2q0K3ZhJNDbW45kj2f6zPoC+L+BTINuHdMzTsopuwmkbgcNA==" - }, "xunit.analyzers": { "type": "Transitive", "resolved": "1.27.0", @@ -412,38 +204,14 @@ "vm2.Ulid": { "type": "Project", "dependencies": { - "Microsoft.Extensions.Configuration.Binder": "[10.0.8, )", - "Microsoft.Extensions.Configuration.CommandLine": "[10.0.8, )", - "Microsoft.Extensions.Configuration.EnvironmentVariables": "[10.0.8, )", - "Microsoft.Extensions.Configuration.Json": "[10.0.8, )", - "Microsoft.Extensions.DependencyInjection": "[10.0.8, )", - "Microsoft.Extensions.Logging": "[10.0.8, )", - "Microsoft.Extensions.Logging.Abstractions": "[10.0.8, )", - "Microsoft.Extensions.Logging.Configuration": "[10.0.8, )", - "Microsoft.Extensions.Logging.Console": "[10.0.8, )", - "Microsoft.Extensions.Options.ConfigurationExtensions": "[10.0.8, )", - "Microsoft.Extensions.TimeProvider.Testing": "[10.6.0, )", - "Newtonsoft.Json": "[13.0.4, )", - "System.Configuration.ConfigurationManager": "[10.0.8, )" + "Microsoft.Extensions.TimeProvider.Testing": "[10.6.0, )" } }, "vm2.UlidTool": { "type": "Project", "dependencies": { - "Microsoft.Extensions.Configuration.Binder": "[10.0.8, )", - "Microsoft.Extensions.Configuration.CommandLine": "[10.0.8, )", - "Microsoft.Extensions.Configuration.EnvironmentVariables": "[10.0.8, )", - "Microsoft.Extensions.Configuration.Json": "[10.0.8, )", - "Microsoft.Extensions.DependencyInjection": "[10.0.8, )", - "Microsoft.Extensions.Logging": "[10.0.8, )", - "Microsoft.Extensions.Logging.Abstractions": "[10.0.8, )", - "Microsoft.Extensions.Logging.Configuration": "[10.0.8, )", - "Microsoft.Extensions.Logging.Console": "[10.0.8, )", - "Microsoft.Extensions.Options.ConfigurationExtensions": "[10.0.8, )", "Microsoft.Extensions.TimeProvider.Testing": "[10.6.0, )", - "Newtonsoft.Json": "[13.0.4, )", "System.CommandLine": "[2.0.8, )", - "System.Configuration.ConfigurationManager": "[10.0.8, )", "vm2.Ulid": "[1.0.0, )" } }, diff --git a/test/UlidType.Tests/NsJson/UlidNsConverterTests.cs b/test/UlidType.Tests/NsJson/UlidNsConverterTests.cs index e81d801..5685850 100644 --- a/test/UlidType.Tests/NsJson/UlidNsConverterTests.cs +++ b/test/UlidType.Tests/NsJson/UlidNsConverterTests.cs @@ -3,13 +3,16 @@ namespace vm2.UlidType.Tests.NsJson; -using Newtonsoft.Json; - -using vm2.UlidSerialization.NsJson; - [ExcludeFromCodeCoverage] -public class UlidNsConverterTests +public class UlidNsConverterTests : TestBase { + public UlidNsConverterTests(ITestOutputHelper output) : base(output) + { + var settings = new JsonSerializerSettings(); + settings.Converters.Add(new UlidNsConverter()); + JsonConvert.DefaultSettings = () => settings; + } + class Subject { @@ -47,7 +50,6 @@ public void Test_CanConvert_Returns_True_For_Ulid_And_Nullable_Ulid() // This disables type name handling, which is the main source of reflection in Newtonsoft.Json. [Fact] - [UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "")] public void Test_NotNull_Ulid_Serializes_To_Json_With_Newtonsoft_Json() { var sut = new Subject("01K5N2TW3MA38KG6D7WNFDPAKS"); @@ -58,7 +60,6 @@ public void Test_NotNull_Ulid_Serializes_To_Json_With_Newtonsoft_Json() } [Fact] - [UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "")] public void Test_NotNull_Ulid_Deserializes_From_Json_With_Newtonsoft_Json() { var ulid = new Ulid("01K5N3A2GJYH10NGHHTWQR4VBP"); @@ -71,7 +72,6 @@ public void Test_NotNull_Ulid_Deserializes_From_Json_With_Newtonsoft_Json() } [Fact] - [UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "")] public void Test_Null_Ulid_Serializes_To_Json_With_Newtonsoft_Json() { var sut = new Subject(); @@ -82,7 +82,6 @@ public void Test_Null_Ulid_Serializes_To_Json_With_Newtonsoft_Json() } [Fact] - [UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "")] public void Test_Null_Ulid_Deserializes_From_Json_With_Newtonsoft_Json() { var json = $@"{{ ""Id"":null}}"; @@ -94,7 +93,6 @@ public void Test_Null_Ulid_Deserializes_From_Json_With_Newtonsoft_Json() } [Fact] - [UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "")] public void Test_Ulid_Serializes_To_Json_With_Newtonsoft_Json() { var sut = new Subject1("01K5N2TW3MA38KG6D7WNFDPAKS"); @@ -105,7 +103,6 @@ public void Test_Ulid_Serializes_To_Json_With_Newtonsoft_Json() } [Fact] - [UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "")] public void Test_Ulid_Deserializes_From_Json_With_Newtonsoft_Json() { var ulid = new Ulid("01K5N3A2GJYH10NGHHTWQR4VBP"); @@ -118,7 +115,6 @@ public void Test_Ulid_Deserializes_From_Json_With_Newtonsoft_Json() } [Fact] - [UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "")] public void Test_Ulid_Deserializes_InvalidUlid_Throws() { var json = @"{ ""Id"": ""U1K5N3A2GJYH10NGHHTWQR4VBP"" }"; @@ -129,7 +125,6 @@ public void Test_Ulid_Deserializes_InvalidUlid_Throws() } [Fact] - [UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "")] public void Test_NotNull_BadString_Ulid_Deserializes_From_Json_With_Newtonsoft_Json() { var ulid = new Ulid("01K5N3A2GJYH10NGHHTWQR4VBP"); @@ -139,5 +134,4 @@ public void Test_NotNull_BadString_Ulid_Deserializes_From_Json_With_Newtonsoft_J deserialize.Should().Throw(); } - } diff --git a/test/UlidType.Tests/UlidType.Tests.csproj b/test/UlidType.Tests/UlidType.Tests.csproj index 2a8d630..b8f2c98 100644 --- a/test/UlidType.Tests/UlidType.Tests.csproj +++ b/test/UlidType.Tests/UlidType.Tests.csproj @@ -6,6 +6,7 @@ + diff --git a/test/UlidType.Tests/packages.lock.json b/test/UlidType.Tests/packages.lock.json index 1d06b9f..2e5a828 100644 --- a/test/UlidType.Tests/packages.lock.json +++ b/test/UlidType.Tests/packages.lock.json @@ -8,131 +8,12 @@ "resolved": "8.10.0", "contentHash": "yGvv+xp0gHFgGwhQcGoDdKIrhLhPi3zYYWWLLHPMctr+G6PWD7QH8L4wqoa5WRZquPbfSV/cP1MraI7ppAHrWw==" }, - "Microsoft.Extensions.Configuration.Binder": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "R3NN1X+kVu14uoxLEW6sBSQyhogDSbaOQzILnCtuXxBN4hx22AgjWPwZX6v/suERFkEDgU1lk12AglHTrUxhlw==", - "dependencies": { - "Microsoft.Extensions.Configuration": "10.0.8", - "Microsoft.Extensions.Configuration.Abstractions": "10.0.8" - } - }, - "Microsoft.Extensions.Configuration.CommandLine": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "nQXq1a4MiInYh+0VF9fguxAl06q2ftmOyYQ+5e933s4rk57xjgkbTjUdFUySzjrcrvDeWsSqlZB+TE8+TbM2HA==", - "dependencies": { - "Microsoft.Extensions.Configuration": "10.0.8", - "Microsoft.Extensions.Configuration.Abstractions": "10.0.8" - } - }, - "Microsoft.Extensions.Configuration.EnvironmentVariables": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "bVGqctAfPGfTxJvNp8pMshtvpsUj6r6JkeiCNVIGVYO5gBxuxdN0Lbr25kEvE/zXdctkEc44g8HssnPgDnFGVA==", - "dependencies": { - "Microsoft.Extensions.Configuration": "10.0.8", - "Microsoft.Extensions.Configuration.Abstractions": "10.0.8" - } - }, - "Microsoft.Extensions.Configuration.Json": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "KLtAZ6A38s1pIfCO2ns6aG14NNGMYNZ4PBYfFK4M+R4A+xuSc6oklhqDcpHZxvDpyBWeFtR5C8iQBw2ng8tUHQ==", - "dependencies": { - "Microsoft.Extensions.Configuration": "10.0.8", - "Microsoft.Extensions.Configuration.Abstractions": "10.0.8", - "Microsoft.Extensions.Configuration.FileExtensions": "10.0.8", - "Microsoft.Extensions.FileProviders.Abstractions": "10.0.8" - } - }, - "Microsoft.Extensions.DependencyInjection": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "daf62xHIrq8pnE709hgaZZN9tSam9TGGepWe1+bE6V3GEuVwJiMs6ib+38lfMCyAJAHiX0vapxBhsuMSV7U+cg==", - "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.8" - } - }, - "Microsoft.Extensions.Logging": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "K60JhWC2hN/Gi7TP68tBxSzk5ACWOs7lkmPzsfA8Bcf/IXTajujt2ORMf9rSMk1bsng6Lv4Y3fuxp3bm1+15ug==", - "dependencies": { - "Microsoft.Extensions.DependencyInjection": "10.0.8", - "Microsoft.Extensions.Logging.Abstractions": "10.0.8", - "Microsoft.Extensions.Options": "10.0.8" - } - }, - "Microsoft.Extensions.Logging.Abstractions": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "fdVadZmsC8jRP0KvKy8mO8f6GV/HyBvElfcSxEhd+5FM5boAw/01iSaCto5G3G37ApJira4A3pNaVvBv8cUiLQ==", - "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.8" - } - }, - "Microsoft.Extensions.Logging.Configuration": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "rxSLTO7xTbcC3DuEJHNEijBr8g14Jj62zQ+DeFu68bsoTYoU8jLcMhc1735PV21bESXsATlL5LsfaWH71FOWAg==", - "dependencies": { - "Microsoft.Extensions.Configuration": "10.0.8", - "Microsoft.Extensions.Configuration.Abstractions": "10.0.8", - "Microsoft.Extensions.Configuration.Binder": "10.0.8", - "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.8", - "Microsoft.Extensions.Logging": "10.0.8", - "Microsoft.Extensions.Logging.Abstractions": "10.0.8", - "Microsoft.Extensions.Options": "10.0.8", - "Microsoft.Extensions.Options.ConfigurationExtensions": "10.0.8" - } - }, - "Microsoft.Extensions.Logging.Console": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "6cv53sHsPnFS56PJw8X4GbNcjeX1KGyFJRxJWvxOgK63cnqeSB1k1eRwjUdkse0tBhwlH6qc9EOYDlan+CYTuw==", - "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.8", - "Microsoft.Extensions.Logging": "10.0.8", - "Microsoft.Extensions.Logging.Abstractions": "10.0.8", - "Microsoft.Extensions.Logging.Configuration": "10.0.8", - "Microsoft.Extensions.Options": "10.0.8" - } - }, - "Microsoft.Extensions.Options.ConfigurationExtensions": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "VOapXeO3lhBH0zYoyAH7tjapuo4V5pTHlevPpiSHueEquAajqd5nF0mttm+h/uE/exwAEuM5s26SzOJtletE3w==", - "dependencies": { - "Microsoft.Extensions.Configuration.Abstractions": "10.0.8", - "Microsoft.Extensions.Configuration.Binder": "10.0.8", - "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.8", - "Microsoft.Extensions.Options": "10.0.8", - "Microsoft.Extensions.Primitives": "10.0.8" - } - }, "Microsoft.Extensions.TimeProvider.Testing": { "type": "Direct", "requested": "[10.6.0, )", "resolved": "10.6.0", "contentHash": "qQDiaYWpvIymGbu+kXaMDS8YdqfeQkv6DOxPF2GSwC+eSzIKqOOnSP34TYt7gKqvB7p8/aSptexnW6nF0CUdnw==" }, - "Microsoft.NET.ILLink.Tasks": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "dVbSXGIFNR5nZcv2tOLoWI+a9T4jtFd77IYjuND+QVe360qWgAF7H0WtoopYhRw/+SgpGUTyrkrh+65+ClNnfw==" - }, "Microsoft.SourceLink.GitHub": { "type": "Direct", "requested": "[10.0.300, )", @@ -171,12 +52,6 @@ "resolved": "7.0.0", "contentHash": "2lMTCQl5bGP4iv0JNkockPnyllC6eHLz+CoK2ICvalvHod+exXSxueu9hq+zNkU7bZBJf8wMfeRC/Edn8AGmEg==" }, - "Newtonsoft.Json": { - "type": "Direct", - "requested": "[13.0.4, )", - "resolved": "13.0.4", - "contentHash": "pdgNNMai3zv51W5aq268sujXUyx7SNdE2bj1wZcWjAQrKMFZV260lbqYop1d2GM67JI1huLRwxo9ZqnfF/lC6A==" - }, "NSubstitute": { "type": "Direct", "requested": "[5.3.0, )", @@ -186,34 +61,14 @@ "Castle.Core": "5.1.1" } }, - "System.Configuration.ConfigurationManager": { - "type": "Direct", - "requested": "[10.0.8, )", - "resolved": "10.0.8", - "contentHash": "QG+HHwJjLyUiRuA9axr5pDqHAxboo7FXCTRakxMABE9CUAUij/tsd/MsgQPJUEppkf+YBLT+F/P/wKIVCAIcNg==", - "dependencies": { - "System.Diagnostics.EventLog": "10.0.8", - "System.Security.Cryptography.ProtectedData": "10.0.8" - } - }, "vm2.TestUtilities": { "type": "Direct", - "requested": "[1.5.1, )", - "resolved": "1.5.1", - "contentHash": "ItST5G6Uiu9OIRE3v7azAcBI4Gtst+9WD4NP2kNQL2X1PPwD7a4etGVsQU+ZC9gxvdN3rXb0SlAMSsip5dI40w==", + "requested": "[2.0.1, )", + "resolved": "2.0.1", + "contentHash": "xddArbvLrj2Uyha/RDh3z7/nlbxvlXlu+J/UgFAlZ31AHdYWFINPqrzccIivIfXMk0wgXexEhFaEacv4NIt5IA==", "dependencies": { "FluentAssertions": "8.10.0", - "Microsoft.Extensions.Configuration.Binder": "10.0.8", - "Microsoft.Extensions.Configuration.CommandLine": "10.0.8", - "Microsoft.Extensions.Configuration.EnvironmentVariables": "10.0.8", - "Microsoft.Extensions.Configuration.Json": "10.0.8", - "Microsoft.Extensions.DependencyInjection": "10.0.8", - "Microsoft.Extensions.Logging": "10.0.8", "Microsoft.Extensions.Logging.Abstractions": "10.0.8", - "Microsoft.Extensions.Logging.Configuration": "10.0.8", - "Microsoft.Extensions.Logging.Console": "10.0.8", - "Microsoft.Extensions.Options.ConfigurationExtensions": "10.0.8", - "System.Configuration.ConfigurationManager": "10.0.8", "xunit.v3.extensibility.core": "3.2.2" } }, @@ -259,35 +114,6 @@ "resolved": "2.2.6", "contentHash": "UitZ43WYJQYmcuScLEDTR95EGulBwk2R4N2zLBhaka8frXGVioa6Bkcbc5Fib8UkHIdrnN1lyzOublenrfpgxA==" }, - "Microsoft.Extensions.Configuration": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "ehZcoPbjzWzS4XFvuz7R3V55SmpdkyMqFURLH3yXaN9NtXd9tR6CGB7pd49HYtCkenl+G7ctXSFLhNI08xLfRg==", - "dependencies": { - "Microsoft.Extensions.Configuration.Abstractions": "10.0.8", - "Microsoft.Extensions.Primitives": "10.0.8" - } - }, - "Microsoft.Extensions.Configuration.Abstractions": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "I63esIFbL3h5pSt7gXpXOlmcwDmYBUoYNEglKfDPFUqtYvSV84f2l28hO2lfVXsV0wdlplgAM7IVz16matapSg==", - "dependencies": { - "Microsoft.Extensions.Primitives": "10.0.8" - } - }, - "Microsoft.Extensions.Configuration.FileExtensions": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "1g9mzuu8gIHkjYb0jLxOTQVl/QDG5nn0b0JzgT/gbgNKr6gXZzxOHRAsdYRc1eDApB7LdHR8uK5vQrNjIQdRrQ==", - "dependencies": { - "Microsoft.Extensions.Configuration": "10.0.8", - "Microsoft.Extensions.Configuration.Abstractions": "10.0.8", - "Microsoft.Extensions.FileProviders.Abstractions": "10.0.8", - "Microsoft.Extensions.FileProviders.Physical": "10.0.8", - "Microsoft.Extensions.Primitives": "10.0.8" - } - }, "Microsoft.Extensions.DependencyInjection.Abstractions": { "type": "Transitive", "resolved": "10.0.8", @@ -298,43 +124,14 @@ "resolved": "8.0.2", "contentHash": "mUBDZZRgZrSyFOsJ2qJJ9fXfqd/kXJwf3AiDoqLD9m6TjY5OO/vLNOb9fb4juC0487eq4hcGN/M2Rh/CKS7QYw==" }, - "Microsoft.Extensions.FileProviders.Abstractions": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "U+oquaPxFdY8lYeEIWO/AD7jDIl9sPW6aVWMQRHU/pZ/SWpLcOrAj2fcLe1HwXl4sYw1ONI56K/eELT3xr4RRQ==", - "dependencies": { - "Microsoft.Extensions.Primitives": "10.0.8" - } - }, - "Microsoft.Extensions.FileProviders.Physical": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "GkPvQe6IdidLu6Q3Lw6+B8NJpW8feW8czZ5mBKt5rXM/x8MvZfEp5WvAsjznzDGd23chIDrW0b2mmt+ScnEgiw==", - "dependencies": { - "Microsoft.Extensions.FileProviders.Abstractions": "10.0.8", - "Microsoft.Extensions.FileSystemGlobbing": "10.0.8", - "Microsoft.Extensions.Primitives": "10.0.8" - } - }, - "Microsoft.Extensions.FileSystemGlobbing": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "IUQet3SY51xIFcFZKtAB6a54/Zdxs7T3SQ84kJtOD6yeXfZgiOMksACWD5qtTmXGQGFH4QYGBOT0KIO8Uy/dJw==" - }, - "Microsoft.Extensions.Options": { + "Microsoft.Extensions.Logging.Abstractions": { "type": "Transitive", "resolved": "10.0.8", - "contentHash": "VBD+131DpTNCNDfA4kIyKTiCySvJGNhwibdWBSdFRu7GMfXLXcXODkgA+KStKbbhzraLglZWUN4nXyHgW4JIRA==", + "contentHash": "fdVadZmsC8jRP0KvKy8mO8f6GV/HyBvElfcSxEhd+5FM5boAw/01iSaCto5G3G37ApJira4A3pNaVvBv8cUiLQ==", "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.8", - "Microsoft.Extensions.Primitives": "10.0.8" + "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.8" } }, - "Microsoft.Extensions.Primitives": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "OBPo4nYhMyIbtueoC10CBm6AGAbo/A9IV8QQ/6ryZS7VvmqpGT7hunazeHLxFawRzn3oLOq4jhqhpBX4tfswWQ==" - }, "Microsoft.SourceLink.Common": { "type": "Transitive", "resolved": "10.0.300", @@ -347,19 +144,14 @@ }, "System.Diagnostics.EventLog": { "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "+Ro7WgIom+BDNH+YhTuZKL6QJ0ctfOpTyfUG/h3aU5KwXt3OaNf0wYWrTvoBUj+34Dy5V8dN9yCco1hAJQ4txw==" + "resolved": "6.0.0", + "contentHash": "lcyUiXTsETK2ALsZrX+nWuHSIQeazhqPphLfaRxzdGaG93+0kELqpgEHtwWOlQe7+jSFnKwaCAgL4kjeZCQJnw==" }, "System.IO.Hashing": { "type": "Transitive", "resolved": "10.0.8", "contentHash": "+dJsbPJ3FyUbTZNplFj0RCKePFizmv6ewDV46JE9q/IVH4c3xTCftHfHelLsAKf0jryIPqgMb5GpS0x7TAY3mg==" }, - "System.Security.Cryptography.ProtectedData": { - "type": "Transitive", - "resolved": "10.0.8", - "contentHash": "/ldVgSfImIBp6fLWS7sLH0BnmtFj0ZwGlZo4Xx2q0K3ZhJNDbW45kj2f6zPoC+L+BTINuHdMzTsopuwmkbgcNA==" - }, "xunit.analyzers": { "type": "Transitive", "resolved": "1.27.0", @@ -412,19 +204,15 @@ "vm2.Ulid": { "type": "Project", "dependencies": { - "Microsoft.Extensions.Configuration.Binder": "[10.0.8, )", - "Microsoft.Extensions.Configuration.CommandLine": "[10.0.8, )", - "Microsoft.Extensions.Configuration.EnvironmentVariables": "[10.0.8, )", - "Microsoft.Extensions.Configuration.Json": "[10.0.8, )", - "Microsoft.Extensions.DependencyInjection": "[10.0.8, )", - "Microsoft.Extensions.Logging": "[10.0.8, )", - "Microsoft.Extensions.Logging.Abstractions": "[10.0.8, )", - "Microsoft.Extensions.Logging.Configuration": "[10.0.8, )", - "Microsoft.Extensions.Logging.Console": "[10.0.8, )", - "Microsoft.Extensions.Options.ConfigurationExtensions": "[10.0.8, )", + "Microsoft.Extensions.TimeProvider.Testing": "[10.6.0, )" + } + }, + "vm2.UlidSerialization.NsJson": { + "type": "Project", + "dependencies": { "Microsoft.Extensions.TimeProvider.Testing": "[10.6.0, )", "Newtonsoft.Json": "[13.0.4, )", - "System.Configuration.ConfigurationManager": "[10.0.8, )" + "vm2.Ulid": "[1.0.0, )" } }, "Microsoft.Testing.Extensions.Telemetry": { @@ -461,6 +249,12 @@ "Microsoft.Testing.Platform": "2.2.3" } }, + "Newtonsoft.Json": { + "type": "CentralTransitive", + "requested": "[13.0.4, )", + "resolved": "13.0.4", + "contentHash": "pdgNNMai3zv51W5aq268sujXUyx7SNdE2bj1wZcWjAQrKMFZV260lbqYop1d2GM67JI1huLRwxo9ZqnfF/lC6A==" + }, "xunit.v3.extensibility.core": { "type": "CentralTransitive", "requested": "[3.2.2, )", diff --git a/test/UlidType.Tests/usings.cs b/test/UlidType.Tests/usings.cs index f7ed2f9..99918ab 100644 --- a/test/UlidType.Tests/usings.cs +++ b/test/UlidType.Tests/usings.cs @@ -4,11 +4,11 @@ global using System.Diagnostics.CodeAnalysis; global using System.Text; global using Microsoft.Extensions.Time.Testing; +global using Newtonsoft.Json; global using vm2.TestUtilities; - global using vm2.Providers; +global using vm2.UlidSerialization.NsJson; global using static vm2.TestUtilities.TestUtilities; - global using static vm2.Ulid; From 8f82dfbc1b7ff8229dcaa0af98301ecf1e0f6b85 Mon Sep 17 00:00:00 2001 From: Val Melamed Date: Tue, 26 May 2026 14:41:15 -0400 Subject: [PATCH 04/22] refactor: use per test JsonSerializerSettings --- README.md | 3 +-- .../NsJson/UlidNsConverterTests.cs | 21 ++++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index dbd9433..247d2ed 100644 --- a/README.md +++ b/README.md @@ -278,8 +278,7 @@ You can also provide your own, thread-safe implementation of `vm2.IRandomNumberG #### Timestamp Provider (`System.TimeProvider`) -By default, the timestamp provider uses `System.TimeProvider.System.GetUtcNow().ToUnixTimeMilliseconds()` converted to Unix epoch time in milliseconds. If you need a different source of time, e.g. for testing purposes, you can override the .NET BCL class `System.TimeProvider` or for testing purposes `System.FakeTimeProvider` to provide your own implementation. -factory. +By default, the timestamp provider uses `System.TimeProvider.System.GetUtcNow().ToUnixTimeMilliseconds()` converted to Unix epoch time in milliseconds. If you need a different source of time, e.g. for testing purposes, you can use `Microsoft.Extensions.Time.Testing.FakeTimeProvider` (package `Microsoft.Extensions.TimeProvider.Testing`) or provide your own implementation that overrides the .NET BCL class `System.TimeProvider` and pass that to the factory. #### Serialization diff --git a/test/UlidType.Tests/NsJson/UlidNsConverterTests.cs b/test/UlidType.Tests/NsJson/UlidNsConverterTests.cs index 5685850..9e7cacd 100644 --- a/test/UlidType.Tests/NsJson/UlidNsConverterTests.cs +++ b/test/UlidType.Tests/NsJson/UlidNsConverterTests.cs @@ -6,11 +6,12 @@ namespace vm2.UlidType.Tests.NsJson; [ExcludeFromCodeCoverage] public class UlidNsConverterTests : TestBase { + JsonSerializerSettings _settings; + public UlidNsConverterTests(ITestOutputHelper output) : base(output) { - var settings = new JsonSerializerSettings(); + _settings = new JsonSerializerSettings(); settings.Converters.Add(new UlidNsConverter()); - JsonConvert.DefaultSettings = () => settings; } @@ -54,7 +55,7 @@ public void Test_NotNull_Ulid_Serializes_To_Json_With_Newtonsoft_Json() { var sut = new Subject("01K5N2TW3MA38KG6D7WNFDPAKS"); - var json = JsonConvert.SerializeObject(sut); + var json = JsonConvert.SerializeObject(sut, _settings); json.Should().Contain(sut?.Id?.ToString()); } @@ -65,7 +66,7 @@ public void Test_NotNull_Ulid_Deserializes_From_Json_With_Newtonsoft_Json() var ulid = new Ulid("01K5N3A2GJYH10NGHHTWQR4VBP"); var json = $@"{{ ""Id"": ""{ulid}"" }}"; - var deserialize = () => JsonConvert.DeserializeObject(json); + var deserialize = () => JsonConvert.DeserializeObject(json, _settings); var sut = deserialize.Should().NotThrow().Which; sut.Id.Should().Be(ulid); @@ -76,7 +77,7 @@ public void Test_Null_Ulid_Serializes_To_Json_With_Newtonsoft_Json() { var sut = new Subject(); - var json = JsonConvert.SerializeObject(sut); + var json = JsonConvert.SerializeObject(sut, _settings); json.Should().Be(@"{""Id"":null}"); } @@ -86,7 +87,7 @@ public void Test_Null_Ulid_Deserializes_From_Json_With_Newtonsoft_Json() { var json = $@"{{ ""Id"":null}}"; - var deserialize = () => JsonConvert.DeserializeObject(json); + var deserialize = () => JsonConvert.DeserializeObject(json, _settings); var sut = deserialize.Should().NotThrow().Which; sut.Id.Should().BeNull(); @@ -97,7 +98,7 @@ public void Test_Ulid_Serializes_To_Json_With_Newtonsoft_Json() { var sut = new Subject1("01K5N2TW3MA38KG6D7WNFDPAKS"); - var json = JsonConvert.SerializeObject(sut); + var json = JsonConvert.SerializeObject(sut, _settings); json.Should().Contain(sut?.Id.ToString()); } @@ -108,7 +109,7 @@ public void Test_Ulid_Deserializes_From_Json_With_Newtonsoft_Json() var ulid = new Ulid("01K5N3A2GJYH10NGHHTWQR4VBP"); var json = $@"{{ ""Id"": ""{ulid}"" }}"; - var deserialize = () => JsonConvert.DeserializeObject(json); + var deserialize = () => JsonConvert.DeserializeObject(json, _settings); var sut = deserialize.Should().NotThrow().Which; sut.Id.Should().Be(ulid); @@ -119,7 +120,7 @@ public void Test_Ulid_Deserializes_InvalidUlid_Throws() { var json = @"{ ""Id"": ""U1K5N3A2GJYH10NGHHTWQR4VBP"" }"; - var deserialize = () => JsonConvert.DeserializeObject(json); + var deserialize = () => JsonConvert.DeserializeObject(json, _settings); deserialize.Should().Throw(); } @@ -130,7 +131,7 @@ public void Test_NotNull_BadString_Ulid_Deserializes_From_Json_With_Newtonsoft_J var ulid = new Ulid("01K5N3A2GJYH10NGHHTWQR4VBP"); var json = $@"{{ ""Id"": ""$%^&{ulid}"" }}"; - var deserialize = () => JsonConvert.DeserializeObject(json); + var deserialize = () => JsonConvert.DeserializeObject(json, _settings); deserialize.Should().Throw(); } From 422da4ee3e2e612746968e3a4013d7ebc42dea19 Mon Sep 17 00:00:00 2001 From: Val Melamed Date: Tue, 26 May 2026 15:10:53 -0400 Subject: [PATCH 05/22] fix: correct variable name for JsonSerializerSettings in UlidNsConverterTests --- test/UlidType.Tests/NsJson/UlidNsConverterTests.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/UlidType.Tests/NsJson/UlidNsConverterTests.cs b/test/UlidType.Tests/NsJson/UlidNsConverterTests.cs index 9e7cacd..078207f 100644 --- a/test/UlidType.Tests/NsJson/UlidNsConverterTests.cs +++ b/test/UlidType.Tests/NsJson/UlidNsConverterTests.cs @@ -11,10 +11,9 @@ public class UlidNsConverterTests : TestBase public UlidNsConverterTests(ITestOutputHelper output) : base(output) { _settings = new JsonSerializerSettings(); - settings.Converters.Add(new UlidNsConverter()); + _settings.Converters.Add(new UlidNsConverter()); } - class Subject { public Ulid? Id { get; set; } From e0623cac1605caf40e42e85211e69ee3d4127d71 Mon Sep 17 00:00:00 2001 From: Val Melamed Date: Tue, 26 May 2026 15:50:34 -0400 Subject: [PATCH 06/22] refactor: renamed folders and projects from UlidType to Ulid --- .github/workflows/CI.yaml | 6 +++--- CLAUDE.md | 6 +++--- README.md | 18 +++++++++--------- .../Program.cs | 0 .../Ulid.Benchmarks.csproj} | 2 +- .../UlidBenchmarks.cs | 0 .../packages.lock.json | 0 examples/GenerateUlids.cs | 2 +- src/{UlidType => Ulid}/IUlidRandomProvider.cs | 0 .../Providers/CryptoRandom.cs | 0 .../Providers/PseudoRandom.cs | 0 .../Serialization/SysJson/UlidSysConverter.cs | 0 src/{UlidType => Ulid}/Ulid.Constants.cs | 0 src/{UlidType => Ulid}/Ulid.cs | 0 .../UlidType.csproj => Ulid/Ulid.csproj} | 0 src/{UlidType => Ulid}/UlidFactory.cs | 0 src/{UlidType => Ulid}/packages.lock.json | 0 src/{UlidType => Ulid}/usings.cs | 0 src/UlidNsConverter/UlidNsConverter.csproj | 2 +- src/UlidTool/README.md | 2 +- src/UlidTool/UlidTool.csproj | 2 +- .../NsJson/UlidNsConverterTests.cs | 0 .../SysJson/UlidSysConverterTests.cs | 0 .../Ulid.Tests.csproj} | 2 +- .../UlidTests.TypesAndData.cs | 2 -- .../UlidTests.cs | 0 .../packages.lock.json | 0 test/{UlidType.Tests => Ulid.Tests}/usings.cs | 4 ++++ vm2.Ulid.slnx | 6 +++--- 29 files changed, 28 insertions(+), 26 deletions(-) rename benchmarks/{UlidType.Benchmarks => Ulid.Benchmarks}/Program.cs (100%) rename benchmarks/{UlidType.Benchmarks/UlidType.Benchmarks.csproj => Ulid.Benchmarks/Ulid.Benchmarks.csproj} (74%) rename benchmarks/{UlidType.Benchmarks => Ulid.Benchmarks}/UlidBenchmarks.cs (100%) rename benchmarks/{UlidType.Benchmarks => Ulid.Benchmarks}/packages.lock.json (100%) rename src/{UlidType => Ulid}/IUlidRandomProvider.cs (100%) rename src/{UlidType => Ulid}/Providers/CryptoRandom.cs (100%) rename src/{UlidType => Ulid}/Providers/PseudoRandom.cs (100%) rename src/{UlidType => Ulid}/Serialization/SysJson/UlidSysConverter.cs (100%) rename src/{UlidType => Ulid}/Ulid.Constants.cs (100%) rename src/{UlidType => Ulid}/Ulid.cs (100%) rename src/{UlidType/UlidType.csproj => Ulid/Ulid.csproj} (100%) rename src/{UlidType => Ulid}/UlidFactory.cs (100%) rename src/{UlidType => Ulid}/packages.lock.json (100%) rename src/{UlidType => Ulid}/usings.cs (100%) rename test/{UlidType.Tests => Ulid.Tests}/NsJson/UlidNsConverterTests.cs (100%) rename test/{UlidType.Tests => Ulid.Tests}/SysJson/UlidSysConverterTests.cs (100%) rename test/{UlidType.Tests/UlidType.Tests.csproj => Ulid.Tests/Ulid.Tests.csproj} (78%) rename test/{UlidType.Tests => Ulid.Tests}/UlidTests.TypesAndData.cs (99%) rename test/{UlidType.Tests => Ulid.Tests}/UlidTests.cs (100%) rename test/{UlidType.Tests => Ulid.Tests}/packages.lock.json (100%) rename test/{UlidType.Tests => Ulid.Tests}/usings.cs (93%) diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index 3add452..d2d8996 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -56,16 +56,16 @@ env: ] TEST_PROJECTS: >- [ - "test/UlidType.Tests/UlidType.Tests.csproj", + "test/Ulid.Tests/Ulid.Tests.csproj", "test/UlidTool.Tests/UlidTool.Tests.csproj" ] BENCHMARK_PROJECTS: >- [ - "benchmarks/UlidType.Benchmarks/UlidType.Benchmarks.csproj" + "benchmarks/Ulid.Benchmarks/Ulid.Benchmarks.csproj" ] PACKAGE_PROJECTS: >- [ - "src/UlidType/UlidType.csproj", + "src/Ulid/Ulid.csproj", "src/UlidNsConverter/UlidNsConverter.csproj", "src/UlidTool/UlidTool.csproj" ] diff --git a/CLAUDE.md b/CLAUDE.md index 8f9ff98..3739823 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -33,12 +33,12 @@ Key design decisions: ```text vm2.Ulid/ ├── src/ -│ ├── UlidType/ # Core library: Ulid struct, UlidFactory, providers +│ ├── Ulid/ # Core library: Ulid struct, UlidFactory, providers │ └── UlidTool/ # CLI tool: generate ULIDs from command line ├── test/ -│ └── UlidType.Tests/ # xUnit v3 tests +│ └── Ulid.Tests/ # xUnit v3 tests ├── benchmarks/ -│ └── UlidType.Benchmarks/ +│ └── Ulid.Benchmarks/ ├── examples/ │ └── GenerateUlids.cs # Runnable script example └── vm2.Ulid.slnx diff --git a/README.md b/README.md index 247d2ed..e89204d 100644 --- a/README.md +++ b/README.md @@ -94,14 +94,14 @@ For testing, database seeding, and other automation, use the [vm2.UlidTool](http ## Get the Code -You can clone the [GitHub repository](https://github.com/vm2/vm2.Ulid). The project is in the `src/UlidType` directory. +You can clone the [GitHub repository](https://github.com/vm2/vm2.Ulid). The project is in the `src/Ulid` directory. ## Build from the Source Code - Command line: ```bash - dotnet build src/UlidType/UlidType.csproj + dotnet build src/Ulid/Ulid.csproj ``` - Visual Studio: @@ -115,7 +115,7 @@ Tests are buildable and runnable from the command line using the `dotnet` CLI an - Command line: ```bash - dotnet test --project test/UlidType.Tests/UlidType.Tests.csproj + dotnet test --project test/Ulid.Tests/Ulid.Tests.csproj ``` - The tests can also be run standalone after building the solution or the test project: @@ -124,13 +124,13 @@ Tests are buildable and runnable from the command line using the `dotnet` CLI an ```bash dotnet build # build the full solution or - dotnet build test/UlidType.Tests/UlidType.Tests.csproj # the test project only + dotnet build test/Ulid.Tests/Ulid.Tests.csproj # the test project only ``` - Run the tests standalone: ```bash - test/UlidType.Tests/bin/Debug/net10.0/UlidType.Tests + test/Ulid.Tests/bin/Debug/net10.0/Ulid.Tests ``` ## Benchmark Tests @@ -141,7 +141,7 @@ runnable from the command line using the `dotnet` CLI. - Command line: ```bash - dotnet run --project benchmarks/UlidType.Benchmarks/UlidType.Benchmarks.csproj -c Release + dotnet run --project benchmarks/Ulid.Benchmarks/Ulid.Benchmarks.csproj -c Release ``` - The benchmarks can also be run standalone after building the benchmark project: @@ -149,19 +149,19 @@ runnable from the command line using the `dotnet` CLI. - build the benchmark project only: ```bash - dotnet build -c Release benchmarks/UlidType.Benchmarks/UlidType.Benchmarks.csproj + dotnet build -c Release benchmarks/Ulid.Benchmarks/Ulid.Benchmarks.csproj ``` - Run the benchmarks standalone (Linux/macOS): ```bash - benchmarks/UlidType.Benchmarks/bin/Release/net10.0/UlidType.Benchmarks + benchmarks/Ulid.Benchmarks/bin/Release/net10.0/Ulid.Benchmarks ``` - Run the benchmarks standalone (Windows): ```bash - benchmarks/UlidType.Benchmarks/bin/Release/net10.0/UlidType.Benchmarks.exe + benchmarks/Ulid.Benchmarks/bin/Release/net10.0/Ulid.Benchmarks.exe ``` ## Build and Run the Example diff --git a/benchmarks/UlidType.Benchmarks/Program.cs b/benchmarks/Ulid.Benchmarks/Program.cs similarity index 100% rename from benchmarks/UlidType.Benchmarks/Program.cs rename to benchmarks/Ulid.Benchmarks/Program.cs diff --git a/benchmarks/UlidType.Benchmarks/UlidType.Benchmarks.csproj b/benchmarks/Ulid.Benchmarks/Ulid.Benchmarks.csproj similarity index 74% rename from benchmarks/UlidType.Benchmarks/UlidType.Benchmarks.csproj rename to benchmarks/Ulid.Benchmarks/Ulid.Benchmarks.csproj index 40c1978..eedf34f 100644 --- a/benchmarks/UlidType.Benchmarks/UlidType.Benchmarks.csproj +++ b/benchmarks/Ulid.Benchmarks/Ulid.Benchmarks.csproj @@ -4,7 +4,7 @@ - + diff --git a/benchmarks/UlidType.Benchmarks/UlidBenchmarks.cs b/benchmarks/Ulid.Benchmarks/UlidBenchmarks.cs similarity index 100% rename from benchmarks/UlidType.Benchmarks/UlidBenchmarks.cs rename to benchmarks/Ulid.Benchmarks/UlidBenchmarks.cs diff --git a/benchmarks/UlidType.Benchmarks/packages.lock.json b/benchmarks/Ulid.Benchmarks/packages.lock.json similarity index 100% rename from benchmarks/UlidType.Benchmarks/packages.lock.json rename to benchmarks/Ulid.Benchmarks/packages.lock.json diff --git a/examples/GenerateUlids.cs b/examples/GenerateUlids.cs index a2eee08..1c9c178 100755 --- a/examples/GenerateUlids.cs +++ b/examples/GenerateUlids.cs @@ -4,7 +4,7 @@ // Copyright (c) 2025-2026 Val Melamed #:property TargetFramework=net10.0 -#:project ../src/UlidType/UlidType.csproj +#:project ../src/Ulid/Ulid.csproj using static System.Console; using static System.Text.Encoding; diff --git a/src/UlidType/IUlidRandomProvider.cs b/src/Ulid/IUlidRandomProvider.cs similarity index 100% rename from src/UlidType/IUlidRandomProvider.cs rename to src/Ulid/IUlidRandomProvider.cs diff --git a/src/UlidType/Providers/CryptoRandom.cs b/src/Ulid/Providers/CryptoRandom.cs similarity index 100% rename from src/UlidType/Providers/CryptoRandom.cs rename to src/Ulid/Providers/CryptoRandom.cs diff --git a/src/UlidType/Providers/PseudoRandom.cs b/src/Ulid/Providers/PseudoRandom.cs similarity index 100% rename from src/UlidType/Providers/PseudoRandom.cs rename to src/Ulid/Providers/PseudoRandom.cs diff --git a/src/UlidType/Serialization/SysJson/UlidSysConverter.cs b/src/Ulid/Serialization/SysJson/UlidSysConverter.cs similarity index 100% rename from src/UlidType/Serialization/SysJson/UlidSysConverter.cs rename to src/Ulid/Serialization/SysJson/UlidSysConverter.cs diff --git a/src/UlidType/Ulid.Constants.cs b/src/Ulid/Ulid.Constants.cs similarity index 100% rename from src/UlidType/Ulid.Constants.cs rename to src/Ulid/Ulid.Constants.cs diff --git a/src/UlidType/Ulid.cs b/src/Ulid/Ulid.cs similarity index 100% rename from src/UlidType/Ulid.cs rename to src/Ulid/Ulid.cs diff --git a/src/UlidType/UlidType.csproj b/src/Ulid/Ulid.csproj similarity index 100% rename from src/UlidType/UlidType.csproj rename to src/Ulid/Ulid.csproj diff --git a/src/UlidType/UlidFactory.cs b/src/Ulid/UlidFactory.cs similarity index 100% rename from src/UlidType/UlidFactory.cs rename to src/Ulid/UlidFactory.cs diff --git a/src/UlidType/packages.lock.json b/src/Ulid/packages.lock.json similarity index 100% rename from src/UlidType/packages.lock.json rename to src/Ulid/packages.lock.json diff --git a/src/UlidType/usings.cs b/src/Ulid/usings.cs similarity index 100% rename from src/UlidType/usings.cs rename to src/Ulid/usings.cs diff --git a/src/UlidNsConverter/UlidNsConverter.csproj b/src/UlidNsConverter/UlidNsConverter.csproj index 96cc468..91d583a 100644 --- a/src/UlidNsConverter/UlidNsConverter.csproj +++ b/src/UlidNsConverter/UlidNsConverter.csproj @@ -28,7 +28,7 @@ - + diff --git a/src/UlidTool/README.md b/src/UlidTool/README.md index 267bfdb..0f209ae 100644 --- a/src/UlidTool/README.md +++ b/src/UlidTool/README.md @@ -23,7 +23,7 @@ A CLI tool for generating ULIDs (Universally Unique Lexicographically Sortable Identifiers). The tool is based on the -[`vm2.Ulid`](https://github.com/vmelamed/vm2.Ulid/tree/main/src/UlidType) library and provides various output formats and +[`vm2.Ulid`](https://github.com/vmelamed/vm2.Ulid/tree/main/src/Ulid) library and provides various output formats and options for generating ULIDs from the command line. ## Installation diff --git a/src/UlidTool/UlidTool.csproj b/src/UlidTool/UlidTool.csproj index 3e04a6a..e8be3b5 100644 --- a/src/UlidTool/UlidTool.csproj +++ b/src/UlidTool/UlidTool.csproj @@ -20,7 +20,7 @@ - + diff --git a/test/UlidType.Tests/NsJson/UlidNsConverterTests.cs b/test/Ulid.Tests/NsJson/UlidNsConverterTests.cs similarity index 100% rename from test/UlidType.Tests/NsJson/UlidNsConverterTests.cs rename to test/Ulid.Tests/NsJson/UlidNsConverterTests.cs diff --git a/test/UlidType.Tests/SysJson/UlidSysConverterTests.cs b/test/Ulid.Tests/SysJson/UlidSysConverterTests.cs similarity index 100% rename from test/UlidType.Tests/SysJson/UlidSysConverterTests.cs rename to test/Ulid.Tests/SysJson/UlidSysConverterTests.cs diff --git a/test/UlidType.Tests/UlidType.Tests.csproj b/test/Ulid.Tests/Ulid.Tests.csproj similarity index 78% rename from test/UlidType.Tests/UlidType.Tests.csproj rename to test/Ulid.Tests/Ulid.Tests.csproj index b8f2c98..38fa32e 100644 --- a/test/UlidType.Tests/UlidType.Tests.csproj +++ b/test/Ulid.Tests/Ulid.Tests.csproj @@ -5,7 +5,7 @@ - + diff --git a/test/UlidType.Tests/UlidTests.TypesAndData.cs b/test/Ulid.Tests/UlidTests.TypesAndData.cs similarity index 99% rename from test/UlidType.Tests/UlidTests.TypesAndData.cs rename to test/Ulid.Tests/UlidTests.TypesAndData.cs index 40428df..c33868e 100644 --- a/test/UlidType.Tests/UlidTests.TypesAndData.cs +++ b/test/Ulid.Tests/UlidTests.TypesAndData.cs @@ -3,8 +3,6 @@ namespace vm2.UlidType.Tests; -using Xunit.Sdk; - public partial class UlidTests { public partial record TimeAndRandom(string testFileLine, long unixTime, byte[] random, bool throws = false) : IXunitSerializable diff --git a/test/UlidType.Tests/UlidTests.cs b/test/Ulid.Tests/UlidTests.cs similarity index 100% rename from test/UlidType.Tests/UlidTests.cs rename to test/Ulid.Tests/UlidTests.cs diff --git a/test/UlidType.Tests/packages.lock.json b/test/Ulid.Tests/packages.lock.json similarity index 100% rename from test/UlidType.Tests/packages.lock.json rename to test/Ulid.Tests/packages.lock.json diff --git a/test/UlidType.Tests/usings.cs b/test/Ulid.Tests/usings.cs similarity index 93% rename from test/UlidType.Tests/usings.cs rename to test/Ulid.Tests/usings.cs index 99918ab..f7d09ea 100644 --- a/test/UlidType.Tests/usings.cs +++ b/test/Ulid.Tests/usings.cs @@ -3,9 +3,13 @@ global using System.Diagnostics.CodeAnalysis; global using System.Text; + global using Microsoft.Extensions.Time.Testing; + global using Newtonsoft.Json; +global using Xunit.Sdk; + global using vm2.TestUtilities; global using vm2.Providers; global using vm2.UlidSerialization.NsJson; diff --git a/vm2.Ulid.slnx b/vm2.Ulid.slnx index 80db9c5..41f04ea 100644 --- a/vm2.Ulid.slnx +++ b/vm2.Ulid.slnx @@ -11,7 +11,7 @@ - + @@ -36,11 +36,11 @@ - + - + From b0eed52e8295960faaa3a344a0566c11abc2c3e2 Mon Sep 17 00:00:00 2001 From: Val Melamed Date: Tue, 26 May 2026 19:49:49 -0400 Subject: [PATCH 07/22] refactor!: established and followed the names of namespace, projects, assemblies, folders. BREAKING CHANGE --- benchmarks/Ulid.Benchmarks/NewUlid.cs | 43 ++++++ benchmarks/Ulid.Benchmarks/ParseUlid.cs | 44 ++++++ .../Ulid.Benchmarks/PreGeneratedData.cs | 27 ++++ .../Ulid.Benchmarks/Ulid.Benchmarks.csproj | 4 +- benchmarks/Ulid.Benchmarks/UlidBenchmarks.cs | 143 ------------------ benchmarks/Ulid.Benchmarks/UlidToString.cs | 40 +++++ benchmarks/Ulid.Benchmarks/usings.cs | 3 + examples/GenerateUlids.cs | 1 + .../{UlidSysConverter.cs => UlidConverter.cs} | 6 +- src/Ulid/Ulid.cs | 2 +- src/Ulid/Ulid.csproj | 1 + src/Ulid/UlidFactory.cs | 2 - src/Ulid/usings.cs | 4 +- .../{UlidNsConverter.cs => UlidConverter.cs} | 4 +- src/UlidNsConverter/UlidNsConverter.csproj | 5 +- src/UlidTool/UlidTool.csproj | 3 +- .../Ulid.Tests/NsJson/UlidNsConverterTests.cs | 11 +- .../SysJson/UlidSysConverterTests.cs | 4 +- test/Ulid.Tests/Ulid.Tests.csproj | 3 +- test/Ulid.Tests/UlidTests.TypesAndData.cs | 2 +- test/Ulid.Tests/UlidTests.cs | 4 +- test/Ulid.Tests/packages.lock.json | 2 +- test/Ulid.Tests/usings.cs | 3 - test/UlidTool.Tests/UlidTool.Tests.csproj | 3 +- test/UlidTool.Tests/UlidToolAppTests.cs | 4 +- test/UlidTool.Tests/usings.cs | 9 -- vm2.Ulid.slnx | 1 + 27 files changed, 198 insertions(+), 180 deletions(-) create mode 100644 benchmarks/Ulid.Benchmarks/NewUlid.cs create mode 100644 benchmarks/Ulid.Benchmarks/ParseUlid.cs create mode 100644 benchmarks/Ulid.Benchmarks/PreGeneratedData.cs delete mode 100644 benchmarks/Ulid.Benchmarks/UlidBenchmarks.cs create mode 100644 benchmarks/Ulid.Benchmarks/UlidToString.cs create mode 100644 benchmarks/Ulid.Benchmarks/usings.cs rename src/Ulid/Serialization/SysJson/{UlidSysConverter.cs => UlidConverter.cs} (95%) rename src/UlidNsConverter/{UlidNsConverter.cs => UlidConverter.cs} (97%) diff --git a/benchmarks/Ulid.Benchmarks/NewUlid.cs b/benchmarks/Ulid.Benchmarks/NewUlid.cs new file mode 100644 index 0000000..66cae25 --- /dev/null +++ b/benchmarks/Ulid.Benchmarks/NewUlid.cs @@ -0,0 +1,43 @@ +// SPDX-License-Identifier: MIT +// Copyright (c) 2025-2026 Val Melamed + +namespace vm2.Benchmarks.Ulid; + +using vm2; + +#if SHORT_RUN +[ShortRunJob] +#else +[SimpleJob(RuntimeMoniker.HostProcess)] +#endif +public class NewUlid +{ + [Params(nameof(CryptoRandom), nameof(PseudoRandom))] + public string RandomProviderType { get; set; } = ""; + + IUlidRandomProvider? RandomProvider { get; set; } + + UlidFactory Factory { get; set; } = null!; + + [GlobalSetup] + public void Setup() + { + RandomProvider = RandomProviderType switch { + nameof(CryptoRandom) => new CryptoRandom(), + nameof(PseudoRandom) => new PseudoRandom(), + _ => throw new InvalidOperationException("RandomProviderType is not set"), + }; + Factory = new(RandomProvider); + } + +#if GUID_BASELINE + [Benchmark(Description = "Guid.NewGuid", Baseline = true)] + public Guid Guid_NewGuid() => Guid.NewGuid(); +#endif + + [Benchmark(Description = "Ulid.NewUlid")] + public Ulid Ulid_NewUlid() => Ulid.NewUlid(); + + [Benchmark(Description = "Factory.NewUlid")] + public Ulid Factory_NewUlid() => Factory.NewUlid(); +} diff --git a/benchmarks/Ulid.Benchmarks/ParseUlid.cs b/benchmarks/Ulid.Benchmarks/ParseUlid.cs new file mode 100644 index 0000000..04a50fe --- /dev/null +++ b/benchmarks/Ulid.Benchmarks/ParseUlid.cs @@ -0,0 +1,44 @@ +// SPDX-License-Identifier: MIT +// Copyright (c) 2025-2026 Val Melamed + +namespace vm2.Benchmarks.Ulid; + +using vm2; + +#if SHORT_RUN +[ShortRunJob] +#else +[SimpleJob(RuntimeMoniker.HostProcess)] +#endif +public class ParseUlid +{ + const int MaxDataItems = 1000; + PreGeneratedData _data2 = null!; + PreGeneratedData _data3 = null!; +#if GUID_BASELINE + PreGeneratedData _data1 = null!; +#endif + + [GlobalSetup] + public void Setup() + { + UlidFactory _factory = new(); + + _data2 = new(MaxDataItems, _ => _factory.NewUlid().ToString()); + _data3 = new(MaxDataItems, _ => Encoding.UTF8.GetBytes(_factory.NewUlid().ToString())); +#if GUID_BASELINE + _data1 = new(MaxDataItems, _ => Guid.NewGuid().ToString()); +#endif + } + + [Benchmark(Description = "Ulid.Parse(StringUtf16)")] + public Ulid Ulid_Parse_Utf16() => Ulid.Parse(_data2.GetNext()); + + [Benchmark(Description = "Ulid.Parse(StringUtf8)")] + public Ulid Ulid_Parse_Utf8() => Ulid.Parse(_data3.GetNext()); + +#if GUID_BASELINE + [Benchmark(Description = "Guid.Parse(string)", Baseline = true)] + public Guid Guid_Parse() => Guid.Parse(_data1.GetNext()); +#endif +} diff --git a/benchmarks/Ulid.Benchmarks/PreGeneratedData.cs b/benchmarks/Ulid.Benchmarks/PreGeneratedData.cs new file mode 100644 index 0000000..0608c21 --- /dev/null +++ b/benchmarks/Ulid.Benchmarks/PreGeneratedData.cs @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: MIT +// Copyright (c) 2025-2026 Val Melamed + +namespace vm2.Benchmarks.Ulid; + +class PreGeneratedData +{ + int _numberItems; + int _index; + T[] _data = null!; + + public PreGeneratedData(int number, Func factory) + { + _numberItems = number; + _index = 0; + _data = [.. Enumerable.Range(0, _numberItems).Select(factory)]; + } + + public T GetNext() + { + if (_index >= _numberItems) + _index = 0; + return _data[_index++]; + } + + public T Current => _data[_index]; +} diff --git a/benchmarks/Ulid.Benchmarks/Ulid.Benchmarks.csproj b/benchmarks/Ulid.Benchmarks/Ulid.Benchmarks.csproj index eedf34f..485f3ac 100644 --- a/benchmarks/Ulid.Benchmarks/Ulid.Benchmarks.csproj +++ b/benchmarks/Ulid.Benchmarks/Ulid.Benchmarks.csproj @@ -1,6 +1,8 @@  + - vm2.UlidType.Benchmark + vm2.Benchmarks.Ulid + vm2.Ulid.Benchmarks diff --git a/benchmarks/Ulid.Benchmarks/UlidBenchmarks.cs b/benchmarks/Ulid.Benchmarks/UlidBenchmarks.cs deleted file mode 100644 index 4d3d2ea..0000000 --- a/benchmarks/Ulid.Benchmarks/UlidBenchmarks.cs +++ /dev/null @@ -1,143 +0,0 @@ -// SPDX-License-Identifier: MIT -// Copyright (c) 2025-2026 Val Melamed - -namespace vm2.UlidType.Benchmarks; - -using System.Text; - -using vm2; -using vm2.Providers; - -#pragma warning disable CA1822 // The benchmark methods must not be static - -class PreGeneratedData -{ - int _numberItems; - int _index; - T[] _data = null!; - - public PreGeneratedData(int number, Func factory) - { - _numberItems = number; - _index = 0; - _data = [.. Enumerable.Range(0, _numberItems).Select(factory)]; - } - - public T GetNext() - { - if (_index >= _numberItems) - _index = 0; - return _data[_index++]; - } - - public T Current => _data[_index]; -} - -#if SHORT_RUN -[ShortRunJob] -#else -[SimpleJob(RuntimeMoniker.HostProcess)] -#endif -public class NewUlid -{ - [Params(nameof(CryptoRandom), nameof(PseudoRandom))] - public string RandomProviderType { get; set; } = ""; - - IUlidRandomProvider? RandomProvider { get; set; } - - UlidFactory Factory { get; set; } = null!; - - [GlobalSetup] - public void Setup() - { - RandomProvider = RandomProviderType switch { - nameof(CryptoRandom) => new CryptoRandom(), - nameof(PseudoRandom) => new PseudoRandom(), - _ => throw new InvalidOperationException("RandomProviderType is not set"), - }; - Factory = new(RandomProvider); - } - -#if GUID_BASELINE - [Benchmark(Description = "Guid.NewGuid", Baseline = true)] - public Guid Guid_NewGuid() => Guid.NewGuid(); -#endif - - [Benchmark(Description = "Ulid.NewUlid")] - public Ulid Ulid_NewUlid() => Ulid.NewUlid(); - - [Benchmark(Description = "Factory.NewUlid")] - public Ulid Factory_NewUlid() => Factory.NewUlid(); -} - -#if SHORT_RUN -[ShortRunJob] -#else -[SimpleJob(RuntimeMoniker.HostProcess)] -#endif -public class UlidToString -{ - const int MaxDataItems = 1000; - -#if GUID_BASELINE - PreGeneratedData _data1 = null!; -#endif - PreGeneratedData _data2 = null!; - - [GlobalSetup] - public void Setup() - { - UlidFactory _factory = new(); - -#if GUID_BASELINE - _data1 = new(MaxDataItems, _ => Guid.NewGuid()); -#endif - _data2 = new(MaxDataItems, _ => _factory.NewUlid()); - } - -#if GUID_BASELINE - [Benchmark(Description = "Guid.ToString", Baseline = true)] - public string Guid_ToString() => _data1.GetNext().ToString(); -#endif - - [Benchmark(Description = "Ulid.ToString")] - public string Ulid_ToString() => _data2.GetNext().ToString(); -} - -#if SHORT_RUN -[ShortRunJob] -#else -[SimpleJob(RuntimeMoniker.HostProcess)] -#endif -public class ParseUlid -{ - const int MaxDataItems = 1000; - PreGeneratedData _data2 = null!; - PreGeneratedData _data3 = null!; -#if GUID_BASELINE - PreGeneratedData _data1 = null!; -#endif - - [GlobalSetup] - public void Setup() - { - UlidFactory _factory = new(); - - _data2 = new(MaxDataItems, _ => _factory.NewUlid().ToString()); - _data3 = new(MaxDataItems, _ => Encoding.UTF8.GetBytes(_factory.NewUlid().ToString())); -#if GUID_BASELINE - _data1 = new(MaxDataItems, _ => Guid.NewGuid().ToString()); -#endif - } - - [Benchmark(Description = "Ulid.Parse(StringUtf16)")] - public Ulid Ulid_Parse_Utf16() => Ulid.Parse(_data2.GetNext()); - - [Benchmark(Description = "Ulid.Parse(StringUtf8)")] - public Ulid Ulid_Parse_Utf8() => Ulid.Parse(_data3.GetNext()); - -#if GUID_BASELINE - [Benchmark(Description = "Guid.Parse(string)", Baseline = true)] - public Guid Guid_Parse() => Guid.Parse(_data1.GetNext()); -#endif -} diff --git a/benchmarks/Ulid.Benchmarks/UlidToString.cs b/benchmarks/Ulid.Benchmarks/UlidToString.cs new file mode 100644 index 0000000..a8b78e4 --- /dev/null +++ b/benchmarks/Ulid.Benchmarks/UlidToString.cs @@ -0,0 +1,40 @@ +// SPDX-License-Identifier: MIT +// Copyright (c) 2025-2026 Val Melamed + +namespace vm2.Benchmarks.Ulid; + +using vm2; + +#if SHORT_RUN +[ShortRunJob] +#else +[SimpleJob(RuntimeMoniker.HostProcess)] +#endif +public class UlidToString +{ + const int MaxDataItems = 1000; + +#if GUID_BASELINE + PreGeneratedData _data1 = null!; +#endif + PreGeneratedData _data2 = null!; + + [GlobalSetup] + public void Setup() + { + UlidFactory _factory = new(); + +#if GUID_BASELINE + _data1 = new(MaxDataItems, _ => Guid.NewGuid()); +#endif + _data2 = new(MaxDataItems, _ => _factory.NewUlid()); + } + +#if GUID_BASELINE + [Benchmark(Description = "Guid.ToString", Baseline = true)] + public string Guid_ToString() => _data1.GetNext().ToString(); +#endif + + [Benchmark(Description = "Ulid.ToString")] + public string Ulid_ToString() => _data2.GetNext().ToString(); +} diff --git a/benchmarks/Ulid.Benchmarks/usings.cs b/benchmarks/Ulid.Benchmarks/usings.cs new file mode 100644 index 0000000..6c12345 --- /dev/null +++ b/benchmarks/Ulid.Benchmarks/usings.cs @@ -0,0 +1,3 @@ +global using System.Text; + +global using vm2.Providers; diff --git a/examples/GenerateUlids.cs b/examples/GenerateUlids.cs index 1c9c178..6e15350 100755 --- a/examples/GenerateUlids.cs +++ b/examples/GenerateUlids.cs @@ -4,6 +4,7 @@ // Copyright (c) 2025-2026 Val Melamed #:property TargetFramework=net10.0 +#:property CopyLocalLockFileAssemblies=true #:project ../src/Ulid/Ulid.csproj using static System.Console; diff --git a/src/Ulid/Serialization/SysJson/UlidSysConverter.cs b/src/Ulid/Serialization/SysJson/UlidConverter.cs similarity index 95% rename from src/Ulid/Serialization/SysJson/UlidSysConverter.cs rename to src/Ulid/Serialization/SysJson/UlidConverter.cs index e820c5c..1094d50 100644 --- a/src/Ulid/Serialization/SysJson/UlidSysConverter.cs +++ b/src/Ulid/Serialization/SysJson/UlidConverter.cs @@ -1,9 +1,7 @@ // SPDX-License-Identifier: MIT // Copyright (c) 2025-2026 Val Melamed -namespace vm2.UlidSerialization.SysJson; - -using System.Text.Json.Serialization; +namespace vm2.Serialization.SysJson; /// /// Provides functionality to convert values to and from JSON format. @@ -14,7 +12,7 @@ namespace vm2.UlidSerialization.SysJson; /// instances are correctly represented as strings in JSON and parsed back into objects /// during deserialization. /// -public class UlidSysConverter : JsonConverter +public class UlidConverter : JsonConverter { /// /// Writes the specified value as a raw JSON string using the provided . diff --git a/src/Ulid/Ulid.cs b/src/Ulid/Ulid.cs index cc446b9..3888fb0 100644 --- a/src/Ulid/Ulid.cs +++ b/src/Ulid/Ulid.cs @@ -11,7 +11,7 @@ namespace vm2; /// order. This struct provides methods for creating, parsing, and manipulating ULIDs, as well as converting them to other formats
/// such as strings or GUIDs. ULIDs are commonly used in distributed systems where unique, sortable identifiers are required. /// -[System.Text.Json.Serialization.JsonConverter(typeof(UlidSysConverter))] +[JsonConverter(typeof(UlidConverter))] public readonly partial struct Ulid : IEquatable, IComparable, diff --git a/src/Ulid/Ulid.csproj b/src/Ulid/Ulid.csproj index 4401ff1..d7790fe 100644 --- a/src/Ulid/Ulid.csproj +++ b/src/Ulid/Ulid.csproj @@ -2,6 +2,7 @@ vm2 + vm2.Ulid diff --git a/src/Ulid/UlidFactory.cs b/src/Ulid/UlidFactory.cs index dcf2107..e0979be 100644 --- a/src/Ulid/UlidFactory.cs +++ b/src/Ulid/UlidFactory.cs @@ -3,8 +3,6 @@ namespace vm2; -using vm2.Providers; - /// /// Provides functionality to generate unique lexicographically sortable identifiers (ULIDs). /// diff --git a/src/Ulid/usings.cs b/src/Ulid/usings.cs index 951c2cc..b7558b9 100644 --- a/src/Ulid/usings.cs +++ b/src/Ulid/usings.cs @@ -7,8 +7,10 @@ global using System.Numerics; global using System.Security.Cryptography; global using System.Text.Json; +global using System.Text.Json.Serialization; -global using vm2.UlidSerialization.SysJson; +global using vm2.Serialization.SysJson; +global using vm2.Providers; global using static System.Buffers.Binary.BinaryPrimitives; global using static vm2.Ulid; diff --git a/src/UlidNsConverter/UlidNsConverter.cs b/src/UlidNsConverter/UlidConverter.cs similarity index 97% rename from src/UlidNsConverter/UlidNsConverter.cs rename to src/UlidNsConverter/UlidConverter.cs index 853036a..87c70d3 100644 --- a/src/UlidNsConverter/UlidNsConverter.cs +++ b/src/UlidNsConverter/UlidConverter.cs @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT // Copyright (c) 2025-2026 Val Melamed -namespace vm2.UlidSerialization.NsJson; +namespace vm2.Serialization.NsJson; using Newtonsoft.Json; @@ -12,7 +12,7 @@ namespace vm2.UlidSerialization.NsJson; /// This converter is used to serialize and deserialize values in JSON format. It /// ensures that instances are correctly represented as strings in JSON and parsed back into objects during deserialization. -public class UlidNsConverter : JsonConverter +public class UlidConverter : JsonConverter { /// /// Determines whether the specified type can be converted to or from a . diff --git a/src/UlidNsConverter/UlidNsConverter.csproj b/src/UlidNsConverter/UlidNsConverter.csproj index 91d583a..e97f414 100644 --- a/src/UlidNsConverter/UlidNsConverter.csproj +++ b/src/UlidNsConverter/UlidNsConverter.csproj @@ -1,13 +1,14 @@  - vm2.UlidSerialization.NsJson + vm2.Serialization.NsJson + vm2.Ulid.Serialization.NsJson false false - vm2.UlidSerialization.NsJson + vm2.Ulid.Serialization.NsJson Companion package: Newtonsoft.Json converter for vm2.Ulid Provides a Newtonsoft.Json converter for the ULID-s from vm2.Ulid. ULID Universally Unique Lexicographically Sortable Identifier .net core vm2 Newtonsoft JSON converter diff --git a/src/UlidTool/UlidTool.csproj b/src/UlidTool/UlidTool.csproj index e8be3b5..fe989d9 100644 --- a/src/UlidTool/UlidTool.csproj +++ b/src/UlidTool/UlidTool.csproj @@ -3,6 +3,7 @@ Exe vm2.UlidTool + vm2.UlidTool false false true @@ -29,7 +30,7 @@ - <_Parameter1>UlidTool.Tests + <_Parameter1>vm2.UlidTool.Tests diff --git a/test/Ulid.Tests/NsJson/UlidNsConverterTests.cs b/test/Ulid.Tests/NsJson/UlidNsConverterTests.cs index 078207f..21d4695 100644 --- a/test/Ulid.Tests/NsJson/UlidNsConverterTests.cs +++ b/test/Ulid.Tests/NsJson/UlidNsConverterTests.cs @@ -1,7 +1,12 @@ // SPDX-License-Identifier: MIT // Copyright (c) 2025-2026 Val Melamed -namespace vm2.UlidType.Tests.NsJson; +namespace vm2.Tests.Ulid.NsJson; + +using Newtonsoft.Json; + +using vm2; +using vm2.Serialization.NsJson; [ExcludeFromCodeCoverage] public class UlidNsConverterTests : TestBase @@ -11,7 +16,7 @@ public class UlidNsConverterTests : TestBase public UlidNsConverterTests(ITestOutputHelper output) : base(output) { _settings = new JsonSerializerSettings(); - _settings.Converters.Add(new UlidNsConverter()); + _settings.Converters.Add(new UlidConverter()); } class Subject @@ -39,7 +44,7 @@ public Subject1() [Fact] public void Test_CanConvert_Returns_True_For_Ulid_And_Nullable_Ulid() { - var sut = new UlidNsConverter(); + var sut = new UlidConverter(); sut.CanConvert(typeof(Ulid)).Should().BeTrue(); sut.CanConvert(typeof(Ulid?)).Should().BeTrue(); diff --git a/test/Ulid.Tests/SysJson/UlidSysConverterTests.cs b/test/Ulid.Tests/SysJson/UlidSysConverterTests.cs index c68e342..0e9d02a 100644 --- a/test/Ulid.Tests/SysJson/UlidSysConverterTests.cs +++ b/test/Ulid.Tests/SysJson/UlidSysConverterTests.cs @@ -1,10 +1,12 @@ // SPDX-License-Identifier: MIT // Copyright (c) 2025-2026 Val Melamed -namespace vm2.UlidType.Tests.SysJson; +namespace vm2.Tests.Ulid.SysJson; using System.Text.Json; +using vm2; + [ExcludeFromCodeCoverage] public class UlidSysConverterTests { diff --git a/test/Ulid.Tests/Ulid.Tests.csproj b/test/Ulid.Tests/Ulid.Tests.csproj index 38fa32e..a76bcfa 100644 --- a/test/Ulid.Tests/Ulid.Tests.csproj +++ b/test/Ulid.Tests/Ulid.Tests.csproj @@ -1,7 +1,8 @@  - vm2.UlidType.Tests + vm2.Tests.Ulid + vm2.Ulid.Tests diff --git a/test/Ulid.Tests/UlidTests.TypesAndData.cs b/test/Ulid.Tests/UlidTests.TypesAndData.cs index c33868e..106ab3d 100644 --- a/test/Ulid.Tests/UlidTests.TypesAndData.cs +++ b/test/Ulid.Tests/UlidTests.TypesAndData.cs @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT // Copyright (c) 2025-2026 Val Melamed -namespace vm2.UlidType.Tests; +namespace vm2.Tests.Ulid; public partial class UlidTests { diff --git a/test/Ulid.Tests/UlidTests.cs b/test/Ulid.Tests/UlidTests.cs index 5e2e58c..a3dc4a1 100644 --- a/test/Ulid.Tests/UlidTests.cs +++ b/test/Ulid.Tests/UlidTests.cs @@ -1,7 +1,9 @@ // SPDX-License-Identifier: MIT // Copyright (c) 2025-2026 Val Melamed -namespace vm2.UlidType.Tests; +namespace vm2.Tests.Ulid; + +using vm2; [ExcludeFromCodeCoverage] public partial class UlidTests(ITestOutputHelper output) : TestBase(output) diff --git a/test/Ulid.Tests/packages.lock.json b/test/Ulid.Tests/packages.lock.json index 2e5a828..8cb6a28 100644 --- a/test/Ulid.Tests/packages.lock.json +++ b/test/Ulid.Tests/packages.lock.json @@ -207,7 +207,7 @@ "Microsoft.Extensions.TimeProvider.Testing": "[10.6.0, )" } }, - "vm2.UlidSerialization.NsJson": { + "vm2.Ulid.Serialization.NsJson": { "type": "Project", "dependencies": { "Microsoft.Extensions.TimeProvider.Testing": "[10.6.0, )", diff --git a/test/Ulid.Tests/usings.cs b/test/Ulid.Tests/usings.cs index f7d09ea..23387ba 100644 --- a/test/Ulid.Tests/usings.cs +++ b/test/Ulid.Tests/usings.cs @@ -6,13 +6,10 @@ global using Microsoft.Extensions.Time.Testing; -global using Newtonsoft.Json; - global using Xunit.Sdk; global using vm2.TestUtilities; global using vm2.Providers; -global using vm2.UlidSerialization.NsJson; global using static vm2.TestUtilities.TestUtilities; global using static vm2.Ulid; diff --git a/test/UlidTool.Tests/UlidTool.Tests.csproj b/test/UlidTool.Tests/UlidTool.Tests.csproj index 2ebc84c..68a89cf 100644 --- a/test/UlidTool.Tests/UlidTool.Tests.csproj +++ b/test/UlidTool.Tests/UlidTool.Tests.csproj @@ -1,7 +1,8 @@ - vm2.UlidTool.Tests + vm2.Tests.UlidTool + vm2.UlidTool.Tests diff --git a/test/UlidTool.Tests/UlidToolAppTests.cs b/test/UlidTool.Tests/UlidToolAppTests.cs index df84be2..ba57a02 100644 --- a/test/UlidTool.Tests/UlidToolAppTests.cs +++ b/test/UlidTool.Tests/UlidToolAppTests.cs @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT // Copyright (c) 2025-2026 Val Melamed -namespace vm2.UlidTool.Tests; +namespace vm2.Tests.UlidTool; public sealed class UlidToolAppTests(ITestOutputHelper output) : TestBase(output) { @@ -12,7 +12,7 @@ public void Run_Default_GeneratesSingleUlid() { using var writer = new StringWriter(); - var exitCode = UlidToolApp.Run(Array.Empty(), writer); + var exitCode = global::UlidToolApp.Run(Array.Empty(), writer); exitCode.Should().Be(0); var lines = GetNonEmptyLines(writer.ToString()); diff --git a/test/UlidTool.Tests/usings.cs b/test/UlidTool.Tests/usings.cs index 4d9cdcb..c81b182 100644 --- a/test/UlidTool.Tests/usings.cs +++ b/test/UlidTool.Tests/usings.cs @@ -1,15 +1,6 @@ // SPDX-License-Identifier: MIT // Copyright (c) 2025-2026 Val Melamed -global using System.Diagnostics.CodeAnalysis; -global using System.Runtime.Serialization; -global using System.Text; global using System.Text.RegularExpressions; global using vm2.TestUtilities; - -global using vm2.Providers; - -global using static vm2.TestUtilities.TestUtilities; - -global using static vm2.Ulid; diff --git a/vm2.Ulid.slnx b/vm2.Ulid.slnx index 41f04ea..d90e9cb 100644 --- a/vm2.Ulid.slnx +++ b/vm2.Ulid.slnx @@ -37,6 +37,7 @@ + From 3416cd7ef2424a2e5748d1683efa2aafb761fe75 Mon Sep 17 00:00:00 2001 From: Val Melamed Date: Wed, 27 May 2026 17:29:44 -0400 Subject: [PATCH 08/22] refactor!: follow the new conventions --- .github/workflows/CI.yaml | 4 ++-- .vscode/settings.json | 6 ------ Directory.Build.props | 16 ++++++++-------- benchmarks/Ulid.Benchmarks/usings.cs | 3 --- .../Benchmarks.Ulid.csproj} | 2 +- benchmarks/{Ulid.Benchmarks => Ulid}/NewUlid.cs | 0 .../{Ulid.Benchmarks => Ulid}/ParseUlid.cs | 0 .../PreGeneratedData.cs | 0 benchmarks/{Ulid.Benchmarks => Ulid}/Program.cs | 0 .../{Ulid.Benchmarks => Ulid}/UlidToString.cs | 0 .../{Ulid.Benchmarks => Ulid}/packages.lock.json | 0 benchmarks/Ulid/usings.cs | 3 +++ .../Serialization.NsJson.Ulid.csproj} | 4 ++-- .../UlidConverter.cs | 8 ++++---- .../packages.lock.json | 0 .../CryptoRandom.cs | 2 +- .../PseudoRandom.cs | 2 +- .../UlidConverter.cs | 8 ++++---- src/Ulid/usings.cs | 4 ++-- src/UlidTool/UlidTool.csproj | 2 +- .../Ulid}/NsJson/UlidNsConverterTests.cs | 8 ++++---- .../Ulid}/SysJson/UlidSysConverterTests.cs | 2 +- .../Ulid.Tests => tests/Ulid}/Ulid.Tests.csproj | 4 ++-- .../Ulid}/UlidTests.TypesAndData.cs | 0 {test/Ulid.Tests => tests/Ulid}/UlidTests.cs | 0 .../Ulid.Tests => tests/Ulid}/packages.lock.json | 0 {test/Ulid.Tests => tests/Ulid}/usings.cs | 2 +- .../UlidTool}/UlidTool.Tests.csproj | 2 +- .../UlidTool}/UlidToolAppTests.cs | 0 .../UlidTool}/packages.lock.json | 0 .../UlidTool.Tests => tests/UlidTool}/usings.cs | 0 vm2.Ulid.slnx | 10 +++++----- 32 files changed, 43 insertions(+), 49 deletions(-) delete mode 100644 .vscode/settings.json delete mode 100644 benchmarks/Ulid.Benchmarks/usings.cs rename benchmarks/{Ulid.Benchmarks/Ulid.Benchmarks.csproj => Ulid/Benchmarks.Ulid.csproj} (83%) rename benchmarks/{Ulid.Benchmarks => Ulid}/NewUlid.cs (100%) rename benchmarks/{Ulid.Benchmarks => Ulid}/ParseUlid.cs (100%) rename benchmarks/{Ulid.Benchmarks => Ulid}/PreGeneratedData.cs (100%) rename benchmarks/{Ulid.Benchmarks => Ulid}/Program.cs (100%) rename benchmarks/{Ulid.Benchmarks => Ulid}/UlidToString.cs (100%) rename benchmarks/{Ulid.Benchmarks => Ulid}/packages.lock.json (100%) create mode 100644 benchmarks/Ulid/usings.cs rename src/{UlidNsConverter/UlidNsConverter.csproj => Serialization.NsJson.Ulid/Serialization.NsJson.Ulid.csproj} (91%) rename src/{UlidNsConverter => Serialization.NsJson.Ulid}/UlidConverter.cs (93%) rename src/{UlidNsConverter => Serialization.NsJson.Ulid}/packages.lock.json (100%) rename src/Ulid/{Providers => Providers.Ulid}/CryptoRandom.cs (93%) rename src/Ulid/{Providers => Providers.Ulid}/PseudoRandom.cs (93%) rename src/Ulid/{Serialization/SysJson => Serialization.SysJson.Ulid}/UlidConverter.cs (93%) rename {test/Ulid.Tests => tests/Ulid}/NsJson/UlidNsConverterTests.cs (95%) rename {test/Ulid.Tests => tests/Ulid}/SysJson/UlidSysConverterTests.cs (97%) rename {test/Ulid.Tests => tests/Ulid}/Ulid.Tests.csproj (60%) rename {test/Ulid.Tests => tests/Ulid}/UlidTests.TypesAndData.cs (100%) rename {test/Ulid.Tests => tests/Ulid}/UlidTests.cs (100%) rename {test/Ulid.Tests => tests/Ulid}/packages.lock.json (100%) rename {test/Ulid.Tests => tests/Ulid}/usings.cs (91%) rename {test/UlidTool.Tests => tests/UlidTool}/UlidTool.Tests.csproj (81%) rename {test/UlidTool.Tests => tests/UlidTool}/UlidToolAppTests.cs (100%) rename {test/UlidTool.Tests => tests/UlidTool}/packages.lock.json (100%) rename {test/UlidTool.Tests => tests/UlidTool}/usings.cs (100%) diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index d2d8996..86b9940 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -56,8 +56,8 @@ env: ] TEST_PROJECTS: >- [ - "test/Ulid.Tests/Ulid.Tests.csproj", - "test/UlidTool.Tests/UlidTool.Tests.csproj" + "tests/Ulid.Tests/Ulid.Tests.csproj", + "tests/UlidTool.Tests/UlidTool.Tests.csproj" ] BENCHMARK_PROJECTS: >- [ diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 6432777..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "cSpell.words": [ - "inproc", - "Ulids" - ] -} diff --git a/Directory.Build.props b/Directory.Build.props index 24fa7b9..b76cc16 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -3,30 +3,30 @@ true true true true true diff --git a/benchmarks/Ulid.Benchmarks/usings.cs b/benchmarks/Ulid.Benchmarks/usings.cs deleted file mode 100644 index 6c12345..0000000 --- a/benchmarks/Ulid.Benchmarks/usings.cs +++ /dev/null @@ -1,3 +0,0 @@ -global using System.Text; - -global using vm2.Providers; diff --git a/benchmarks/Ulid.Benchmarks/Ulid.Benchmarks.csproj b/benchmarks/Ulid/Benchmarks.Ulid.csproj similarity index 83% rename from benchmarks/Ulid.Benchmarks/Ulid.Benchmarks.csproj rename to benchmarks/Ulid/Benchmarks.Ulid.csproj index 485f3ac..d822c6f 100644 --- a/benchmarks/Ulid.Benchmarks/Ulid.Benchmarks.csproj +++ b/benchmarks/Ulid/Benchmarks.Ulid.csproj @@ -2,7 +2,7 @@ vm2.Benchmarks.Ulid - vm2.Ulid.Benchmarks + vm2.Benchmarks.Ulid diff --git a/benchmarks/Ulid.Benchmarks/NewUlid.cs b/benchmarks/Ulid/NewUlid.cs similarity index 100% rename from benchmarks/Ulid.Benchmarks/NewUlid.cs rename to benchmarks/Ulid/NewUlid.cs diff --git a/benchmarks/Ulid.Benchmarks/ParseUlid.cs b/benchmarks/Ulid/ParseUlid.cs similarity index 100% rename from benchmarks/Ulid.Benchmarks/ParseUlid.cs rename to benchmarks/Ulid/ParseUlid.cs diff --git a/benchmarks/Ulid.Benchmarks/PreGeneratedData.cs b/benchmarks/Ulid/PreGeneratedData.cs similarity index 100% rename from benchmarks/Ulid.Benchmarks/PreGeneratedData.cs rename to benchmarks/Ulid/PreGeneratedData.cs diff --git a/benchmarks/Ulid.Benchmarks/Program.cs b/benchmarks/Ulid/Program.cs similarity index 100% rename from benchmarks/Ulid.Benchmarks/Program.cs rename to benchmarks/Ulid/Program.cs diff --git a/benchmarks/Ulid.Benchmarks/UlidToString.cs b/benchmarks/Ulid/UlidToString.cs similarity index 100% rename from benchmarks/Ulid.Benchmarks/UlidToString.cs rename to benchmarks/Ulid/UlidToString.cs diff --git a/benchmarks/Ulid.Benchmarks/packages.lock.json b/benchmarks/Ulid/packages.lock.json similarity index 100% rename from benchmarks/Ulid.Benchmarks/packages.lock.json rename to benchmarks/Ulid/packages.lock.json diff --git a/benchmarks/Ulid/usings.cs b/benchmarks/Ulid/usings.cs new file mode 100644 index 0000000..76daf3c --- /dev/null +++ b/benchmarks/Ulid/usings.cs @@ -0,0 +1,3 @@ +global using System.Text; + +global using vm2.Providers.Ulid; diff --git a/src/UlidNsConverter/UlidNsConverter.csproj b/src/Serialization.NsJson.Ulid/Serialization.NsJson.Ulid.csproj similarity index 91% rename from src/UlidNsConverter/UlidNsConverter.csproj rename to src/Serialization.NsJson.Ulid/Serialization.NsJson.Ulid.csproj index e97f414..888a884 100644 --- a/src/UlidNsConverter/UlidNsConverter.csproj +++ b/src/Serialization.NsJson.Ulid/Serialization.NsJson.Ulid.csproj @@ -1,8 +1,8 @@  - vm2.Serialization.NsJson - vm2.Ulid.Serialization.NsJson + vm2.Serialization.NsJson.Ulid + vm2.Serialization.NsJson.Ulid false false diff --git a/src/UlidNsConverter/UlidConverter.cs b/src/Serialization.NsJson.Ulid/UlidConverter.cs similarity index 93% rename from src/UlidNsConverter/UlidConverter.cs rename to src/Serialization.NsJson.Ulid/UlidConverter.cs index 87c70d3..6188aa6 100644 --- a/src/UlidNsConverter/UlidConverter.cs +++ b/src/Serialization.NsJson.Ulid/UlidConverter.cs @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT // Copyright (c) 2025-2026 Val Melamed -namespace vm2.Serialization.NsJson; +namespace vm2.Serialization.NsJson.Ulid; using Newtonsoft.Json; @@ -22,7 +22,7 @@ public class UlidConverter : JsonConverter /// if the specified type is or ; otherwise, . /// public override bool CanConvert(Type objectType) - => objectType == typeof(Ulid) || objectType == typeof(Ulid?); + => objectType == typeof(vm2.Ulid) || objectType == typeof(vm2.Ulid?); /// /// Writes the JSON representation of the specified object using the provided . @@ -38,13 +38,13 @@ public override void WriteJson(JsonWriter writer, object? value, JsonSerializer return; } - if (value is Ulid ulid) + if (value is vm2.Ulid ulid) { writer.WriteValue(ulid.ToString()); return; } - throw new JsonWriterException($"Expected value to be of type {typeof(Ulid)} or null, but got {value?.GetType()}."); + throw new JsonWriterException($"Expected value to be of type {typeof(vm2.Ulid)} or null, but got {value?.GetType()}."); } /// diff --git a/src/UlidNsConverter/packages.lock.json b/src/Serialization.NsJson.Ulid/packages.lock.json similarity index 100% rename from src/UlidNsConverter/packages.lock.json rename to src/Serialization.NsJson.Ulid/packages.lock.json diff --git a/src/Ulid/Providers/CryptoRandom.cs b/src/Ulid/Providers.Ulid/CryptoRandom.cs similarity index 93% rename from src/Ulid/Providers/CryptoRandom.cs rename to src/Ulid/Providers.Ulid/CryptoRandom.cs index 459164e..478f5fc 100644 --- a/src/Ulid/Providers/CryptoRandom.cs +++ b/src/Ulid/Providers.Ulid/CryptoRandom.cs @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT // Copyright (c) 2025-2026 Val Melamed -namespace vm2.Providers; +namespace vm2.Providers.Ulid; /// /// A random provider that uses cryptographic random number generation. diff --git a/src/Ulid/Providers/PseudoRandom.cs b/src/Ulid/Providers.Ulid/PseudoRandom.cs similarity index 93% rename from src/Ulid/Providers/PseudoRandom.cs rename to src/Ulid/Providers.Ulid/PseudoRandom.cs index 5047527..1045c90 100644 --- a/src/Ulid/Providers/PseudoRandom.cs +++ b/src/Ulid/Providers.Ulid/PseudoRandom.cs @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT // Copyright (c) 2025-2026 Val Melamed -namespace vm2.Providers; +namespace vm2.Providers.Ulid; /// /// A random provider that uses a pseudo-random number generator. diff --git a/src/Ulid/Serialization/SysJson/UlidConverter.cs b/src/Ulid/Serialization.SysJson.Ulid/UlidConverter.cs similarity index 93% rename from src/Ulid/Serialization/SysJson/UlidConverter.cs rename to src/Ulid/Serialization.SysJson.Ulid/UlidConverter.cs index 1094d50..a4d61a4 100644 --- a/src/Ulid/Serialization/SysJson/UlidConverter.cs +++ b/src/Ulid/Serialization.SysJson.Ulid/UlidConverter.cs @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT // Copyright (c) 2025-2026 Val Melamed -namespace vm2.Serialization.SysJson; +namespace vm2.Serialization.SysJson.Ulid; /// /// Provides functionality to convert values to and from JSON format. @@ -12,7 +12,7 @@ namespace vm2.Serialization.SysJson; /// instances are correctly represented as strings in JSON and parsed back into objects /// during deserialization. /// -public class UlidConverter : JsonConverter +public class UlidConverter : JsonConverter { /// /// Writes the specified value as a raw JSON string using the provided . @@ -25,7 +25,7 @@ public class UlidConverter : JsonConverter /// implementation but is required by the method signature. public override void Write( Utf8JsonWriter writer, - Ulid value, + vm2.Ulid value, JsonSerializerOptions _) { Span utf8Chars = stackalloc byte[UlidStringLength]; @@ -47,7 +47,7 @@ public override void Write( /// The serializer __ to use during deserialization. This parameter is not used in this implementation. /// The value parsed from the JSON data. /// Thrown if the JSON data does not represent a valid ULID. - public override Ulid Read(ref Utf8JsonReader reader, Type _, JsonSerializerOptions __) + public override vm2.Ulid Read(ref Utf8JsonReader reader, Type _, JsonSerializerOptions __) { try { diff --git a/src/Ulid/usings.cs b/src/Ulid/usings.cs index b7558b9..2782b61 100644 --- a/src/Ulid/usings.cs +++ b/src/Ulid/usings.cs @@ -9,8 +9,8 @@ global using System.Text.Json; global using System.Text.Json.Serialization; -global using vm2.Serialization.SysJson; -global using vm2.Providers; +global using vm2.Serialization.SysJson.Ulid; +global using vm2.Providers.Ulid; global using static System.Buffers.Binary.BinaryPrimitives; global using static vm2.Ulid; diff --git a/src/UlidTool/UlidTool.csproj b/src/UlidTool/UlidTool.csproj index fe989d9..c2670bf 100644 --- a/src/UlidTool/UlidTool.csproj +++ b/src/UlidTool/UlidTool.csproj @@ -30,7 +30,7 @@ - <_Parameter1>vm2.UlidTool.Tests + <_Parameter1>vm2.Tests.UlidTool diff --git a/test/Ulid.Tests/NsJson/UlidNsConverterTests.cs b/tests/Ulid/NsJson/UlidNsConverterTests.cs similarity index 95% rename from test/Ulid.Tests/NsJson/UlidNsConverterTests.cs rename to tests/Ulid/NsJson/UlidNsConverterTests.cs index 21d4695..465e161 100644 --- a/test/Ulid.Tests/NsJson/UlidNsConverterTests.cs +++ b/tests/Ulid/NsJson/UlidNsConverterTests.cs @@ -1,19 +1,19 @@ // SPDX-License-Identifier: MIT // Copyright (c) 2025-2026 Val Melamed -namespace vm2.Tests.Ulid.NsJson; +namespace vm2.Tests.Serialization.NsJson.Ulid; using Newtonsoft.Json; using vm2; -using vm2.Serialization.NsJson; +using vm2.Serialization.NsJson.Ulid; [ExcludeFromCodeCoverage] -public class UlidNsConverterTests : TestBase +public class UlidConverterTests : TestBase { JsonSerializerSettings _settings; - public UlidNsConverterTests(ITestOutputHelper output) : base(output) + public UlidConverterTests(ITestOutputHelper output) : base(output) { _settings = new JsonSerializerSettings(); _settings.Converters.Add(new UlidConverter()); diff --git a/test/Ulid.Tests/SysJson/UlidSysConverterTests.cs b/tests/Ulid/SysJson/UlidSysConverterTests.cs similarity index 97% rename from test/Ulid.Tests/SysJson/UlidSysConverterTests.cs rename to tests/Ulid/SysJson/UlidSysConverterTests.cs index 0e9d02a..383d8d3 100644 --- a/test/Ulid.Tests/SysJson/UlidSysConverterTests.cs +++ b/tests/Ulid/SysJson/UlidSysConverterTests.cs @@ -8,7 +8,7 @@ namespace vm2.Tests.Ulid.SysJson; using vm2; [ExcludeFromCodeCoverage] -public class UlidSysConverterTests +public class UlidSysConverterTests(ITestOutputHelper output) : TestBase(output) { class Subject diff --git a/test/Ulid.Tests/Ulid.Tests.csproj b/tests/Ulid/Ulid.Tests.csproj similarity index 60% rename from test/Ulid.Tests/Ulid.Tests.csproj rename to tests/Ulid/Ulid.Tests.csproj index a76bcfa..2378e2a 100644 --- a/test/Ulid.Tests/Ulid.Tests.csproj +++ b/tests/Ulid/Ulid.Tests.csproj @@ -2,12 +2,12 @@ vm2.Tests.Ulid - vm2.Ulid.Tests + vm2.Tests.Ulid - + diff --git a/test/Ulid.Tests/UlidTests.TypesAndData.cs b/tests/Ulid/UlidTests.TypesAndData.cs similarity index 100% rename from test/Ulid.Tests/UlidTests.TypesAndData.cs rename to tests/Ulid/UlidTests.TypesAndData.cs diff --git a/test/Ulid.Tests/UlidTests.cs b/tests/Ulid/UlidTests.cs similarity index 100% rename from test/Ulid.Tests/UlidTests.cs rename to tests/Ulid/UlidTests.cs diff --git a/test/Ulid.Tests/packages.lock.json b/tests/Ulid/packages.lock.json similarity index 100% rename from test/Ulid.Tests/packages.lock.json rename to tests/Ulid/packages.lock.json diff --git a/test/Ulid.Tests/usings.cs b/tests/Ulid/usings.cs similarity index 91% rename from test/Ulid.Tests/usings.cs rename to tests/Ulid/usings.cs index 23387ba..7f45da5 100644 --- a/test/Ulid.Tests/usings.cs +++ b/tests/Ulid/usings.cs @@ -9,7 +9,7 @@ global using Xunit.Sdk; global using vm2.TestUtilities; -global using vm2.Providers; +global using vm2.Providers.Ulid; global using static vm2.TestUtilities.TestUtilities; global using static vm2.Ulid; diff --git a/test/UlidTool.Tests/UlidTool.Tests.csproj b/tests/UlidTool/UlidTool.Tests.csproj similarity index 81% rename from test/UlidTool.Tests/UlidTool.Tests.csproj rename to tests/UlidTool/UlidTool.Tests.csproj index 68a89cf..6b06a6e 100644 --- a/test/UlidTool.Tests/UlidTool.Tests.csproj +++ b/tests/UlidTool/UlidTool.Tests.csproj @@ -2,7 +2,7 @@ vm2.Tests.UlidTool - vm2.UlidTool.Tests + vm2.Tests.UlidTool diff --git a/test/UlidTool.Tests/UlidToolAppTests.cs b/tests/UlidTool/UlidToolAppTests.cs similarity index 100% rename from test/UlidTool.Tests/UlidToolAppTests.cs rename to tests/UlidTool/UlidToolAppTests.cs diff --git a/test/UlidTool.Tests/packages.lock.json b/tests/UlidTool/packages.lock.json similarity index 100% rename from test/UlidTool.Tests/packages.lock.json rename to tests/UlidTool/packages.lock.json diff --git a/test/UlidTool.Tests/usings.cs b/tests/UlidTool/usings.cs similarity index 100% rename from test/UlidTool.Tests/usings.cs rename to tests/UlidTool/usings.cs diff --git a/vm2.Ulid.slnx b/vm2.Ulid.slnx index d90e9cb..37a546d 100644 --- a/vm2.Ulid.slnx +++ b/vm2.Ulid.slnx @@ -11,7 +11,7 @@ - + @@ -36,12 +36,12 @@ + - - - - + + + From cf1ad98409314eadffb4436478ee727a8d71ce2c Mon Sep 17 00:00:00 2001 From: Val Melamed Date: Wed, 27 May 2026 17:58:11 -0400 Subject: [PATCH 09/22] fix: update project paths in CI configuration and Directory.Build.props for consistency --- .github/workflows/CI.yaml | 8 ++++---- Directory.Build.props | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index 86b9940..d1d1d9b 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -56,17 +56,17 @@ env: ] TEST_PROJECTS: >- [ - "tests/Ulid.Tests/Ulid.Tests.csproj", - "tests/UlidTool.Tests/UlidTool.Tests.csproj" + "tests/Ulid/Ulid.Tests.csproj", + "tests/UlidTool/UlidTool.Tests.csproj" ] BENCHMARK_PROJECTS: >- [ - "benchmarks/Ulid.Benchmarks/Ulid.Benchmarks.csproj" + "benchmarks/Ulid/Benchmarks.Ulid.csproj" ] PACKAGE_PROJECTS: >- [ "src/Ulid/Ulid.csproj", - "src/UlidNsConverter/UlidNsConverter.csproj", + "src/Serialization.NsJson.Ulid/Serialization.NsJson.Ulid.csproj", "src/UlidTool/UlidTool.csproj" ] RUNNERS_OS: >- diff --git a/Directory.Build.props b/Directory.Build.props index b76cc16..5bff10d 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -3,8 +3,7 @@ true From e79f13125241c25e01bfd25b4f2897dbd369f76e Mon Sep 17 00:00:00 2001 From: Val Melamed Date: Wed, 27 May 2026 19:18:57 -0400 Subject: [PATCH 10/22] fix: add OutputType property to project files for consistency --- benchmarks/Ulid/Benchmarks.Ulid.csproj | 3 ++- src/Serialization.NsJson.Ulid/Serialization.NsJson.Ulid.csproj | 1 + src/Ulid/Ulid.csproj | 1 + tests/Ulid/Ulid.Tests.csproj | 1 + tests/UlidTool/UlidTool.Tests.csproj | 1 + 5 files changed, 6 insertions(+), 1 deletion(-) diff --git a/benchmarks/Ulid/Benchmarks.Ulid.csproj b/benchmarks/Ulid/Benchmarks.Ulid.csproj index d822c6f..be37f47 100644 --- a/benchmarks/Ulid/Benchmarks.Ulid.csproj +++ b/benchmarks/Ulid/Benchmarks.Ulid.csproj @@ -1,12 +1,13 @@  + Exe vm2.Benchmarks.Ulid vm2.Benchmarks.Ulid - + diff --git a/src/Serialization.NsJson.Ulid/Serialization.NsJson.Ulid.csproj b/src/Serialization.NsJson.Ulid/Serialization.NsJson.Ulid.csproj index 888a884..723e407 100644 --- a/src/Serialization.NsJson.Ulid/Serialization.NsJson.Ulid.csproj +++ b/src/Serialization.NsJson.Ulid/Serialization.NsJson.Ulid.csproj @@ -1,6 +1,7 @@  + Library vm2.Serialization.NsJson.Ulid vm2.Serialization.NsJson.Ulid false diff --git a/src/Ulid/Ulid.csproj b/src/Ulid/Ulid.csproj index d7790fe..c37739d 100644 --- a/src/Ulid/Ulid.csproj +++ b/src/Ulid/Ulid.csproj @@ -1,6 +1,7 @@  + Library vm2 vm2.Ulid diff --git a/tests/Ulid/Ulid.Tests.csproj b/tests/Ulid/Ulid.Tests.csproj index 2378e2a..237d243 100644 --- a/tests/Ulid/Ulid.Tests.csproj +++ b/tests/Ulid/Ulid.Tests.csproj @@ -1,6 +1,7 @@  + Exe vm2.Tests.Ulid vm2.Tests.Ulid diff --git a/tests/UlidTool/UlidTool.Tests.csproj b/tests/UlidTool/UlidTool.Tests.csproj index 6b06a6e..864a4c9 100644 --- a/tests/UlidTool/UlidTool.Tests.csproj +++ b/tests/UlidTool/UlidTool.Tests.csproj @@ -1,6 +1,7 @@ + Exe vm2.Tests.UlidTool vm2.Tests.UlidTool From 1cc702e900f7737cffacda91f678b024c6485d63 Mon Sep 17 00:00:00 2001 From: Val Melamed Date: Wed, 27 May 2026 20:20:01 -0400 Subject: [PATCH 11/22] fix: remove AssemblyName property for consistency in project file --- benchmarks/Ulid/Benchmarks.Ulid.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/benchmarks/Ulid/Benchmarks.Ulid.csproj b/benchmarks/Ulid/Benchmarks.Ulid.csproj index be37f47..461e996 100644 --- a/benchmarks/Ulid/Benchmarks.Ulid.csproj +++ b/benchmarks/Ulid/Benchmarks.Ulid.csproj @@ -3,7 +3,6 @@ Exe vm2.Benchmarks.Ulid - vm2.Benchmarks.Ulid From b535d3f125bf25de3c75be5efd4b5b78cf9ff676 Mon Sep 17 00:00:00 2001 From: Val Melamed Date: Wed, 27 May 2026 20:38:28 -0400 Subject: [PATCH 12/22] fix: remove AssemblyName property for consistency in benchmark and test project files --- tests/Ulid/Ulid.Tests.csproj | 1 - tests/UlidTool/UlidTool.Tests.csproj | 1 - 2 files changed, 2 deletions(-) diff --git a/tests/Ulid/Ulid.Tests.csproj b/tests/Ulid/Ulid.Tests.csproj index 237d243..e51911c 100644 --- a/tests/Ulid/Ulid.Tests.csproj +++ b/tests/Ulid/Ulid.Tests.csproj @@ -3,7 +3,6 @@ Exe vm2.Tests.Ulid - vm2.Tests.Ulid diff --git a/tests/UlidTool/UlidTool.Tests.csproj b/tests/UlidTool/UlidTool.Tests.csproj index 864a4c9..85483ee 100644 --- a/tests/UlidTool/UlidTool.Tests.csproj +++ b/tests/UlidTool/UlidTool.Tests.csproj @@ -3,7 +3,6 @@ Exe vm2.Tests.UlidTool - vm2.Tests.UlidTool From 9dd40a410952aa813538dc5f03e66d97607ed3e7 Mon Sep 17 00:00:00 2001 From: Val Melamed Date: Wed, 27 May 2026 21:14:37 -0400 Subject: [PATCH 13/22] fix: rename benchmark project file and update references for consistency --- .github/workflows/CI.yaml | 2 +- .../Ulid/{Benchmarks.Ulid.csproj => Ulid.Benchmarks.csproj} | 0 src/UlidTool/UlidTool.csproj | 2 +- tests/UlidTool/UlidToolAppTests.cs | 2 +- vm2.Ulid.slnx | 2 +- 5 files changed, 4 insertions(+), 4 deletions(-) rename benchmarks/Ulid/{Benchmarks.Ulid.csproj => Ulid.Benchmarks.csproj} (100%) diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index d1d1d9b..6d73e28 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -61,7 +61,7 @@ env: ] BENCHMARK_PROJECTS: >- [ - "benchmarks/Ulid/Benchmarks.Ulid.csproj" + "benchmarks/Ulid/Ulid.Benchmarks.csproj" ] PACKAGE_PROJECTS: >- [ diff --git a/benchmarks/Ulid/Benchmarks.Ulid.csproj b/benchmarks/Ulid/Ulid.Benchmarks.csproj similarity index 100% rename from benchmarks/Ulid/Benchmarks.Ulid.csproj rename to benchmarks/Ulid/Ulid.Benchmarks.csproj diff --git a/src/UlidTool/UlidTool.csproj b/src/UlidTool/UlidTool.csproj index c2670bf..11e7aea 100644 --- a/src/UlidTool/UlidTool.csproj +++ b/src/UlidTool/UlidTool.csproj @@ -30,7 +30,7 @@ - <_Parameter1>vm2.Tests.UlidTool + <_Parameter1>UlidTool.Tests diff --git a/tests/UlidTool/UlidToolAppTests.cs b/tests/UlidTool/UlidToolAppTests.cs index ba57a02..804a35f 100644 --- a/tests/UlidTool/UlidToolAppTests.cs +++ b/tests/UlidTool/UlidToolAppTests.cs @@ -12,7 +12,7 @@ public void Run_Default_GeneratesSingleUlid() { using var writer = new StringWriter(); - var exitCode = global::UlidToolApp.Run(Array.Empty(), writer); + var exitCode = UlidToolApp.Run(Array.Empty(), writer); exitCode.Should().Be(0); var lines = GetNonEmptyLines(writer.ToString()); diff --git a/vm2.Ulid.slnx b/vm2.Ulid.slnx index 37a546d..5caddf3 100644 --- a/vm2.Ulid.slnx +++ b/vm2.Ulid.slnx @@ -11,7 +11,7 @@ - + From 09abca0189da19dc893260bdb03893f9f6784102 Mon Sep 17 00:00:00 2001 From: Val Melamed Date: Wed, 27 May 2026 22:32:54 -0400 Subject: [PATCH 14/22] fix: update PackageProjectUrl for accuracy in project file --- src/Ulid/Ulid.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Ulid/Ulid.csproj b/src/Ulid/Ulid.csproj index c37739d..8f1fcb1 100644 --- a/src/Ulid/Ulid.csproj +++ b/src/Ulid/Ulid.csproj @@ -11,7 +11,7 @@ Universally Unique Lexicographically Sortable Identifier (ULID) for .NET Implementation of the Universally Unique Lexicographically Sortable Identifier (ULID) for .NET. ULID Universally Unique Lexicographically Sortable Identifier .net core vm2 - https://github.com/vmelamed/vm2.Ulid/blob/main/src/UlidType/UlidType.csproj + https://github.com/vmelamed/vm2.Ulid/blob/main/src/Ulid/Ulid.csproj https://github.com/vmelamed/vm2.Ulid README.md No significant changes, but moved to the latest build pipeline templates. From ca4f82c25f693e91d8c2439dd870222a3390b1f7 Mon Sep 17 00:00:00 2001 From: Val Melamed Date: Thu, 28 May 2026 00:55:45 -0400 Subject: [PATCH 15/22] fix: update UlidConverter comments for consistency in type references --- src/Serialization.NsJson.Ulid/UlidConverter.cs | 12 ++++++------ .../Serialization.SysJson.Ulid/UlidConverter.cs | 16 ++++++++-------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Serialization.NsJson.Ulid/UlidConverter.cs b/src/Serialization.NsJson.Ulid/UlidConverter.cs index 6188aa6..e52493b 100644 --- a/src/Serialization.NsJson.Ulid/UlidConverter.cs +++ b/src/Serialization.NsJson.Ulid/UlidConverter.cs @@ -6,20 +6,20 @@ namespace vm2.Serialization.NsJson.Ulid; using Newtonsoft.Json; /// -/// Provides functionality to convert values to and from JSON format. +/// Provides functionality to convert values to and from JSON format. /// Implements the Newtonsoft.Json.". /// -/// This converter is used to serialize and deserialize values in JSON format. It -/// ensures that instances are correctly represented as strings in JSON and parsed back into objects during deserialization. +/// This converter is used to serialize and deserialize values in JSON format. It +/// ensures that instances are correctly represented as strings in JSON and parsed back into objects during deserialization. public class UlidConverter : JsonConverter { /// - /// Determines whether the specified type can be converted to or from a . + /// Determines whether the specified type can be converted to or from a . /// /// The type to evaluate for conversion compatibility. /// - /// if the specified type is or ; otherwise, . + /// if the specified type is or ; otherwise, . /// public override bool CanConvert(Type objectType) => objectType == typeof(vm2.Ulid) || objectType == typeof(vm2.Ulid?); diff --git a/src/Ulid/Serialization.SysJson.Ulid/UlidConverter.cs b/src/Ulid/Serialization.SysJson.Ulid/UlidConverter.cs index a4d61a4..58ae149 100644 --- a/src/Ulid/Serialization.SysJson.Ulid/UlidConverter.cs +++ b/src/Ulid/Serialization.SysJson.Ulid/UlidConverter.cs @@ -4,23 +4,23 @@ namespace vm2.Serialization.SysJson.Ulid; /// -/// Provides functionality to convert values to and from JSON format. +/// Provides functionality to convert values to and from JSON format. /// Implements the System.Text.Json.Serialization.". /// /// -/// This converter is used to serialize and deserialize values when working with JSON. It ensures that -/// instances are correctly represented as strings in JSON and parsed back into objects +/// This converter is used to serialize and deserialize values when working with JSON. It ensures that +/// instances are correctly represented as strings in JSON and parsed back into objects /// during deserialization. /// public class UlidConverter : JsonConverter { /// - /// Writes the specified value as a raw JSON string using the provided . + /// Writes the specified value as a raw JSON string using the provided . /// /// - /// The to which the value will be written. Cannot be null. + /// The to which the value will be written. Cannot be null. /// - /// The value to write. + /// The value to write. /// The to use during serialization. This parameter is not used in this /// implementation but is required by the method signature. public override void Write( @@ -43,9 +43,9 @@ public override void Write( /// /// The to read the JSON data from. /// The type of the object to convert. This parameter is ignored as this method always converts to a . + /// cref="vm2.Ulid"/>. /// The serializer __ to use during deserialization. This parameter is not used in this implementation. - /// The value parsed from the JSON data. + /// The value parsed from the JSON data. /// Thrown if the JSON data does not represent a valid ULID. public override vm2.Ulid Read(ref Utf8JsonReader reader, Type _, JsonSerializerOptions __) { From a12e54353f4cadc2e1bdf17f292446cacbc5a027 Mon Sep 17 00:00:00 2001 From: Val Melamed Date: Thu, 28 May 2026 11:59:53 -0400 Subject: [PATCH 16/22] chore: diff-shared.sh --- .github/CONVENTIONS.md | 20 +++++++++++++++++++- .github/workflows/Prerelease.yaml | 3 ++- .github/workflows/Release.yaml | 3 ++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/.github/CONVENTIONS.md b/.github/CONVENTIONS.md index 9e9317d..9b812d4 100644 --- a/.github/CONVENTIONS.md +++ b/.github/CONVENTIONS.md @@ -132,7 +132,7 @@ The project owner is a non-native English speaker. - Global usings: defined in **`usings.cs` per project** - Standard folder layout: - `src/` — source code - - `test/` — test projects. The stack is: **xUnit, FluentAssertions, NSubstitute, MTP v2, coverage** + - `tests/` — test projects. The stack is: **xUnit, FluentAssertions, NSubstitute, MTP v2, coverage** - `benchmarks/` — **BenchmarkDotNet** projects (desirable) - `examples/` — usage examples (desirable). Prefer single-file programs for simplicity, but multi-file projects are acceptable if the example is complex enough to warrant it. - `docs/` — documentation (optional, in addition to README.md, e.g. blogs, design docs, etc.) @@ -257,6 +257,24 @@ The project owner is a non-native English speaker. - Events: past tense — `OrderPlacedEvent`. - Commands: imperative — `PlaceOrderCommand`. - Handlers: `...Handler` suffix. +- **Always set `` explicitly** in every `*.csproj` to make it clear to the CI scripts what type of file to run for tests and benchmarks, and to avoid drift when project file names change. +- Prefer **domain-first public API type names** without suffixes unless required to avoid language-level symbol conflicts. +- Prefer **package-first artifact identity** for NuGet packages and assemblies: + - Package ID: `vm2.` or `vm2..` + - Assembly name: `vm2.` or `vm2..` +- Always set `` explicitly in every `*.csproj`. +- Root namespace policy: + - For core libraries, prioritize API clarity and discoverability. + - For feature libraries, use a stable hierarchy that mirrors the feature domain. +- Test naming policy (tests-first): + - Project and assembly: `.Tests` or `..Tests` to group tests by package and feature, e.g. `Ulid.Tests` for `vm2.Ulid` package, `UlidTool.Tests` for `vm2.UlidTool` package, etc. This also makes it clear that the assembly contains tests for the specific package or feature. **Prefer the default name for the assembly** - the name of the project file without the extension, e.g. `Ulid.Tests` for `Ulid.Tests.csproj`. + - Namespace: `vm2.Tests.[.]` to avoid conflicts where `` is also a name of a type, e.g. `Ulid`. It also makes it clear that the namespace contains tests for the specific package, class, or feature, e.g. `vm2.Tests.Ulid` for `vm2.Ulid` package/type, `vm2.Tests.UlidTool` for `vm2.UlidTool` package/feature (tool), etc. + - **Always specify `Exe` explicitly** in test project files to make it clear to the CI scripts what type of file to run. +- Benchmark naming policy (benchmarks-first): + - Project and assembly: `.Benchmarks` or `..Benchmarks` to group benchmarks by package and feature, e.g. `Ulid.Benchmarks` for `vm2.Ulid` package. This also makes it clear that the assembly contains benchmarks for the specific package or feature. **The assembly name MUST be the default** - the name of the project file without the extension, e.g. `Ulid.Benchmarks` for `Ulid.Benchmarks.csproj`. This is BenchmarkDotNet's required convention. + - Namespace: `vm2.Benchmarks.[.Feature]` to avoid conflicts where `` is also a name of a type, e.g. `Ulid`. It also makes it clear that the namespace contains tests for the specific package, class, or feature, e.g. `vm2.Tests.Ulid` for `vm2.Ulid` package/type. + - **Always specify `Exe`** in benchmark project files to make it clear to the CI scripts what type of file to run for benchmarks. +- Inside a single repository, do not mix naming strategies. Choose one namespace strategy and apply it consistently to `src/`, `tests/`, and `benchmarks/`. ## Git and PR Hygiene diff --git a/.github/workflows/Prerelease.yaml b/.github/workflows/Prerelease.yaml index 4247e53..659dd12 100644 --- a/.github/workflows/Prerelease.yaml +++ b/.github/workflows/Prerelease.yaml @@ -26,7 +26,8 @@ on: env: PACKAGE_PROJECTS: >- [ - "src/UlidType/UlidType.csproj", + "src/Ulid/Ulid.csproj", + "src/Serialization.NsJson.Ulid/Serialization.NsJson.Ulid.csproj", "src/UlidTool/UlidTool.csproj" ] # Ensure the NUGET_API_KEY secret is issued by the server selected here. diff --git a/.github/workflows/Release.yaml b/.github/workflows/Release.yaml index 9a8c650..997a1c1 100644 --- a/.github/workflows/Release.yaml +++ b/.github/workflows/Release.yaml @@ -12,7 +12,8 @@ on: env: PACKAGE_PROJECTS: >- [ - "src/UlidType/UlidType.csproj", + "src/Ulid/Ulid.csproj", + "src/Serialization.NsJson.Ulid/Serialization.NsJson.Ulid.csproj", "src/UlidTool/UlidTool.csproj" ] # Ensure the NUGET_API_KEY secret is issued by the server selected here. From 86f1fceb6ea86084811c862ad9983a7fc416107c Mon Sep 17 00:00:00 2001 From: Val Melamed Date: Thu, 28 May 2026 12:06:14 -0400 Subject: [PATCH 17/22] chore: cosmetic change for consistency --- .github/workflows/CI.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index 6d73e28..ae28c4e 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -52,7 +52,7 @@ concurrency: env: BUILD_PROJECTS: >- [ - "./vm2.Ulid.slnx" + "vm2.Ulid.slnx" ] TEST_PROJECTS: >- [ From 62db3f9f3a9a12e53a31af7e7b1d413e51fd29a8 Mon Sep 17 00:00:00 2001 From: Val Melamed Date: Thu, 28 May 2026 17:14:00 -0400 Subject: [PATCH 18/22] fix: update .gitattributes for consistent line endings and add AOT guidelines to conventions --- .gitattributes | 18 ++++---- .github/CONVENTIONS.md | 42 +++++++++++++++++++ Directory.Build.props | 9 ++-- .../Serialization.NsJson.Ulid.csproj | 4 +- .../UlidConverter.cs | 4 +- .../packages.lock.json | 6 +++ src/Ulid/Ulid.csproj | 1 - src/UlidTool/UlidTool.csproj | 3 +- src/UlidTool/packages.lock.json | 6 +++ 9 files changed, 74 insertions(+), 19 deletions(-) diff --git a/.gitattributes b/.gitattributes index d9d5236..6046cc7 100644 --- a/.gitattributes +++ b/.gitattributes @@ -10,15 +10,15 @@ *.ps1 text eol=crlf # Explicitly declare text files you want to always be normalized and converted to native line endings on checkout -*.cs text diff=csharp -*.csproj text -*.sln text -*.slnx text -*.md text -*.json text -*.yaml text -*.yml text -*.xml text +*.cs text eol=lf diff=csharp +*.csproj text eol=lf +*.sln text eol=lf +*.slnx text eol=lf +*.md text eol=lf +*.json text eol=lf +*.yaml text eol=lf +*.yml text eol=lf +*.xml text eol=lf # Denote all files that are truly binary and should not be modified *.png binary diff --git a/.github/CONVENTIONS.md b/.github/CONVENTIONS.md index 9b812d4..bf4a370 100644 --- a/.github/CONVENTIONS.md +++ b/.github/CONVENTIONS.md @@ -24,6 +24,7 @@ - [Performance](#performance) - [Security](#security) - [Naming](#naming) + - [AOT and Trimming](#aot-and-trimming) - [Git and PR Hygiene](#git-and-pr-hygiene) - [Files with shared content](#files-with-shared-content-5) - [Documentation](#documentation) @@ -276,6 +277,47 @@ The project owner is a non-native English speaker. - **Always specify `Exe`** in benchmark project files to make it clear to the CI scripts what type of file to run for benchmarks. - Inside a single repository, do not mix naming strategies. Choose one namespace strategy and apply it consistently to `src/`, `tests/`, and `benchmarks/`. +## AOT and Trimming + +- Scope by project type (usually set in **`Directory.Build.props`** with folder-based conditions): + - **test** and **benchmark** projects: no trimming and no AOT checks by default; optimize for correctness/perf feedback, not deployment-shape validation: + - `IsAotCompatible=false` + - `VerifyReferenceAotCompatibility=false` + - `EnableTrimAnalyzer=false` + - `IsTrimmable=false` + - **product** projects: trimming and AOT checks enabled by default (usually set in **`Directory.Build.props`**): + - `IsAotCompatible=true` + - `VerifyReferenceAotCompatibility=true` when strict dependency metadata validation is desired. + - `EnableTrimAnalyzer=true` + - `IsTrimmable=true` +- Build and classify diagnostics (handled in CI and local `dotnet build`/`dotnet publish`): + - IL2026-family: trimming compatibility issue. + - IL3050-family: AOT dynamic-code issue. + - IL3058: referenced assembly is not marked AOT-compatible. +- If IL2026 appears (code-level fix): + - first try `DynamicallyAccessedMembersAttribute` to make reflection requirements explicit. + - if an API is fundamentally trim-unsafe, annotate the API boundary with `RequiresUnreferencedCodeAttribute`. + - avoid suppression-first fixes. +- If IL3050 appears (code-level fix): + - first try removing/replacing dynamic code patterns. + - if an API is fundamentally AOT-unsafe, annotate the API boundary with `RequiresDynamicCodeAttribute`. + - if unsupported surface is substantial, split into AOT-safe core and non-AOT companion code/package. +- If strict AOT/trimming is not worth it for a specific product project (project-level opt-out in **`*.csproj`**): + - `IsAotCompatible=false` + - `VerifyReferenceAotCompatibility=false` + If needed, also set: + - `EnableTrimAnalyzer=false` + - `IsTrimmable=false` + - use this only as an explicit, documented design decision with rationale in README/changelog/PR. +- Re-run checks and verify warning flow (CI and local build/publish): + - warnings should be either fixed or intentionally bubbled at public API boundaries. + - unsupported features must be documented clearly for consumers. +- IL warning suppression policy (code-level and project-level): + - **do not suppress IL warnings** (`IL2xxx`, `IL3xxx`) by default. + - only suppress when the safety argument is explicit, tested, and documented. + - if you think suppression is the easiest fix, stop and re-evaluate API design first. + - unless you really, really know what you are doing, Val. + ## Git and PR Hygiene - Commit messages: `[(scope)][!]: ` - where scope is optional `!` marks **breaking change(s)** diff --git a/Directory.Build.props b/Directory.Build.props index 5bff10d..96e4525 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -94,11 +94,10 @@ true - - + + + true + true true true diff --git a/src/Serialization.NsJson.Ulid/Serialization.NsJson.Ulid.csproj b/src/Serialization.NsJson.Ulid/Serialization.NsJson.Ulid.csproj index 723e407..a061453 100644 --- a/src/Serialization.NsJson.Ulid/Serialization.NsJson.Ulid.csproj +++ b/src/Serialization.NsJson.Ulid/Serialization.NsJson.Ulid.csproj @@ -3,7 +3,9 @@ Library vm2.Serialization.NsJson.Ulid - vm2.Serialization.NsJson.Ulid + + false false diff --git a/src/Serialization.NsJson.Ulid/UlidConverter.cs b/src/Serialization.NsJson.Ulid/UlidConverter.cs index e52493b..812530f 100644 --- a/src/Serialization.NsJson.Ulid/UlidConverter.cs +++ b/src/Serialization.NsJson.Ulid/UlidConverter.cs @@ -7,7 +7,7 @@ namespace vm2.Serialization.NsJson.Ulid; /// /// Provides functionality to convert values to and from JSON format. -/// Implements the Newtonsoft.Json.". +/// Implements . /// /// This converter is used to serialize and deserialize values in JSON format. It /// ensures that instances are correctly represented as strings in JSON and parsed back into /// The type to evaluate for conversion compatibility. /// - /// if the specified type is or ; otherwise, . + /// if the specified type is or vm2.Ulid?; otherwise, . /// public override bool CanConvert(Type objectType) => objectType == typeof(vm2.Ulid) || objectType == typeof(vm2.Ulid?); diff --git a/src/Serialization.NsJson.Ulid/packages.lock.json b/src/Serialization.NsJson.Ulid/packages.lock.json index 3b5ec32..1240789 100644 --- a/src/Serialization.NsJson.Ulid/packages.lock.json +++ b/src/Serialization.NsJson.Ulid/packages.lock.json @@ -8,6 +8,12 @@ "resolved": "10.6.0", "contentHash": "qQDiaYWpvIymGbu+kXaMDS8YdqfeQkv6DOxPF2GSwC+eSzIKqOOnSP34TYt7gKqvB7p8/aSptexnW6nF0CUdnw==" }, + "Microsoft.NET.ILLink.Tasks": { + "type": "Direct", + "requested": "[10.0.8, )", + "resolved": "10.0.8", + "contentHash": "dVbSXGIFNR5nZcv2tOLoWI+a9T4jtFd77IYjuND+QVe360qWgAF7H0WtoopYhRw/+SgpGUTyrkrh+65+ClNnfw==" + }, "Microsoft.SourceLink.GitHub": { "type": "Direct", "requested": "[10.0.300, )", diff --git a/src/Ulid/Ulid.csproj b/src/Ulid/Ulid.csproj index 8f1fcb1..12816f3 100644 --- a/src/Ulid/Ulid.csproj +++ b/src/Ulid/Ulid.csproj @@ -3,7 +3,6 @@ Library vm2 - vm2.Ulid diff --git a/src/UlidTool/UlidTool.csproj b/src/UlidTool/UlidTool.csproj index 11e7aea..9e5c004 100644 --- a/src/UlidTool/UlidTool.csproj +++ b/src/UlidTool/UlidTool.csproj @@ -3,9 +3,10 @@ Exe vm2.UlidTool - vm2.UlidTool + false false + true ulid diff --git a/src/UlidTool/packages.lock.json b/src/UlidTool/packages.lock.json index cb9f52e..cfe3bb9 100644 --- a/src/UlidTool/packages.lock.json +++ b/src/UlidTool/packages.lock.json @@ -8,6 +8,12 @@ "resolved": "10.6.0", "contentHash": "qQDiaYWpvIymGbu+kXaMDS8YdqfeQkv6DOxPF2GSwC+eSzIKqOOnSP34TYt7gKqvB7p8/aSptexnW6nF0CUdnw==" }, + "Microsoft.NET.ILLink.Tasks": { + "type": "Direct", + "requested": "[10.0.8, )", + "resolved": "10.0.8", + "contentHash": "dVbSXGIFNR5nZcv2tOLoWI+a9T4jtFd77IYjuND+QVe360qWgAF7H0WtoopYhRw/+SgpGUTyrkrh+65+ClNnfw==" + }, "Microsoft.SourceLink.GitHub": { "type": "Direct", "requested": "[10.0.300, )", From fd743fc378338e8c08d3ab8cb8038b8593139dc6 Mon Sep 17 00:00:00 2001 From: Val Melamed Date: Thu, 28 May 2026 21:01:25 -0400 Subject: [PATCH 19/22] refactor: change "test/" to "tests/" --- CLAUDE.md | 2 +- README.md | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 3739823..f51bfac 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -35,7 +35,7 @@ vm2.Ulid/ ├── src/ │ ├── Ulid/ # Core library: Ulid struct, UlidFactory, providers │ └── UlidTool/ # CLI tool: generate ULIDs from command line -├── test/ +├── tests/ │ └── Ulid.Tests/ # xUnit v3 tests ├── benchmarks/ │ └── Ulid.Benchmarks/ diff --git a/README.md b/README.md index e89204d..5f5fd5e 100644 --- a/README.md +++ b/README.md @@ -115,7 +115,7 @@ Tests are buildable and runnable from the command line using the `dotnet` CLI an - Command line: ```bash - dotnet test --project test/Ulid.Tests/Ulid.Tests.csproj + dotnet test --project tests/Ulid.Tests/Ulid.Tests.csproj ``` - The tests can also be run standalone after building the solution or the test project: @@ -124,13 +124,13 @@ Tests are buildable and runnable from the command line using the `dotnet` CLI an ```bash dotnet build # build the full solution or - dotnet build test/Ulid.Tests/Ulid.Tests.csproj # the test project only + dotnet build tests/Ulid.Tests/Ulid.Tests.csproj # the test project only ``` - Run the tests standalone: ```bash - test/Ulid.Tests/bin/Debug/net10.0/Ulid.Tests + tests/Ulid.Tests/bin/Debug/net10.0/Ulid.Tests ``` ## Benchmark Tests From 9792a5db5bfd57107e06a4f5790355f0c638bc94 Mon Sep 17 00:00:00 2001 From: Val Melamed Date: Fri, 29 May 2026 17:35:01 -0400 Subject: [PATCH 20/22] fix: update test utilities package version to 2.0.2 and improve regex conditions in build props --- Directory.Build.props | 15 ++++++--------- Directory.Packages.props | 2 +- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 96e4525..51eb429 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -3,19 +3,20 @@ true true true @@ -104,12 +105,8 @@ - - all - - - all - + + diff --git a/Directory.Packages.props b/Directory.Packages.props index 96d4a0c..c7aa4be 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -19,7 +19,7 @@ - + From 21d99092e29ea9789e402af43a66c1f0454da6fb Mon Sep 17 00:00:00 2001 From: Val Melamed Date: Fri, 29 May 2026 17:46:44 -0400 Subject: [PATCH 21/22] fix: update vm2.TestUtilities package version to 2.0.2 --- tests/Ulid/packages.lock.json | 6 +++--- tests/UlidTool/packages.lock.json | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/Ulid/packages.lock.json b/tests/Ulid/packages.lock.json index 8cb6a28..d686d57 100644 --- a/tests/Ulid/packages.lock.json +++ b/tests/Ulid/packages.lock.json @@ -63,9 +63,9 @@ }, "vm2.TestUtilities": { "type": "Direct", - "requested": "[2.0.1, )", - "resolved": "2.0.1", - "contentHash": "xddArbvLrj2Uyha/RDh3z7/nlbxvlXlu+J/UgFAlZ31AHdYWFINPqrzccIivIfXMk0wgXexEhFaEacv4NIt5IA==", + "requested": "[2.0.2, )", + "resolved": "2.0.2", + "contentHash": "yjulWlMvLnbGPnXe2BUOmiYaOPnoxeeRuKgsSLXL3cxOa1/GX4HnRUBtfEyBYbO0kzdolGLN3dm/ENIwNnFGpw==", "dependencies": { "FluentAssertions": "8.10.0", "Microsoft.Extensions.Logging.Abstractions": "10.0.8", diff --git a/tests/UlidTool/packages.lock.json b/tests/UlidTool/packages.lock.json index f22ae3b..408864a 100644 --- a/tests/UlidTool/packages.lock.json +++ b/tests/UlidTool/packages.lock.json @@ -63,9 +63,9 @@ }, "vm2.TestUtilities": { "type": "Direct", - "requested": "[2.0.1, )", - "resolved": "2.0.1", - "contentHash": "xddArbvLrj2Uyha/RDh3z7/nlbxvlXlu+J/UgFAlZ31AHdYWFINPqrzccIivIfXMk0wgXexEhFaEacv4NIt5IA==", + "requested": "[2.0.2, )", + "resolved": "2.0.2", + "contentHash": "yjulWlMvLnbGPnXe2BUOmiYaOPnoxeeRuKgsSLXL3cxOa1/GX4HnRUBtfEyBYbO0kzdolGLN3dm/ENIwNnFGpw==", "dependencies": { "FluentAssertions": "8.10.0", "Microsoft.Extensions.Logging.Abstractions": "10.0.8", From 9d8258ded2d8cf074653ce28aab6dde9f3f5c5e4 Mon Sep 17 00:00:00 2001 From: Val Melamed Date: Fri, 29 May 2026 18:02:08 -0400 Subject: [PATCH 22/22] fix: update benchmark tests instructions for clarity and add missing command line options --- README.md | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5f5fd5e..e28b2d1 100644 --- a/README.md +++ b/README.md @@ -135,8 +135,7 @@ Tests are buildable and runnable from the command line using the `dotnet` CLI an ## Benchmark Tests -The benchmark tests project is in the `benchmarks` directory. It uses BenchmarkDotNet v0.13.8. Benchmarks are buildable and -runnable from the command line using the `dotnet` CLI. +The benchmark tests project is in the `benchmarks` directory. It uses BenchmarkDotNet Benchmarks are buildable and runnable from the command line using the `dotnet` in **Release** configuration. - Command line: @@ -155,15 +154,21 @@ runnable from the command line using the `dotnet` CLI. - Run the benchmarks standalone (Linux/macOS): ```bash - benchmarks/Ulid.Benchmarks/bin/Release/net10.0/Ulid.Benchmarks + benchmarks/Ulid.Benchmarks/bin/Release/net10.0/Ulid.Benchmarks --filter '*' --join --exporters json markdown --memory ``` - Run the benchmarks standalone (Windows): ```bash - benchmarks/Ulid.Benchmarks/bin/Release/net10.0/Ulid.Benchmarks.exe + benchmarks/Ulid.Benchmarks/bin/Release/net10.0/Ulid.Benchmarks.exe --filter '*' --join --exporters json markdown --memory ``` +- You can also use the Bash script `run-benchmarks.sh` from the `vm2.DevOps` repository to run the benchmarks, e.g.: + + ```bash + bash vm2.DevOps/.github/scripts/run-benchmarks.sh $VM2_REPOS/vm2.Ulid/benchmarks/Ulid/Ulid.Benchmarks.csproj + ``` + ## Build and Run the Example The example is a file-based application `GenerateUlids.cs` in the `examples` directory. It demonstrates basic usage of the