From ec63804ae9436df1fd558d411eb38b7af1af28c2 Mon Sep 17 00:00:00 2001 From: bUnit bot Date: Fri, 19 Jul 2024 20:57:29 +0000 Subject: [PATCH 1/4] Set version to '1.31-preview' --- version.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.json b/version.json index 6bad75a5d..d009bb001 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/main/src/NerdBank.GitVersioning/version.schema.json", - "version": "1.30-preview", + "version": "1.31-preview", "assemblyVersion": { "precision": "revision" }, From e1bc92c2ed64b2982f8f59d1e01b68ecb36d15ea Mon Sep 17 00:00:00 2001 From: Steven Giesel Date: Wed, 14 Aug 2024 21:50:39 +0200 Subject: [PATCH 2/4] fix: Only throw bUnit created exceptions to the user (#1519) * fix: Only throw bUnit created exceptions to the user * fix: .NET 9 p7 issues * chore: Bump packages * fix: S3993 --- .github/workflows/release.yml | 2 +- CHANGELOG.md | 4 ++++ Directory.Build.props | 2 +- benchmark/bunit.benchmarks/bunit.benchmarks.csproj | 2 +- src/Directory.Build.props | 2 +- src/bunit.web/Extensions/InputFile/InputFileExtensions.cs | 4 ++-- .../Implementation/VirtualizeJSRuntimeInvocationHandler.cs | 6 ++++++ src/bunit.web/Rendering/BunitHtmlParser.cs | 4 ++++ .../Localization/PlaceholderStringLocalization.cs | 2 ++ tests/bunit.generators.tests/bunit.generators.tests.csproj | 4 ++-- tests/bunit.testassets/XunitExtensions/RepeatAttribute.cs | 1 + tests/bunit.testassets/bunit.testassets.csproj | 4 ++-- .../NavigationManager/FakeNavigationManagerTest.cs | 2 +- 13 files changed, 28 insertions(+), 11 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9172732d0..9baec9601 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -65,7 +65,7 @@ jobs: 9.0.x - name: 🛠️ Update changelog - uses: thomaseizinger/keep-a-changelog-new-release@3.0.0 + uses: thomaseizinger/keep-a-changelog-new-release@3.1.0 with: version: ${{ env.NBGV_SemVer2 }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 781da071e..00ca02203 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ All notable changes to **bUnit** will be documented in this file. The project ad ## [Unreleased] +### Fixed + +- `UploadFile` should only throw an exception when the file size exceeds the maximum allowed size. Reported by [@candritzky](https://github.com/candritzky). Fixed by [@linkdotnet](https://github.com/linkdotnet). + ## [1.30.3] - 2024-07-21 ### Fixed diff --git a/Directory.Build.props b/Directory.Build.props index d9a96bfbf..c4b492f6a 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -52,7 +52,7 @@ - + - + diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 991738e81..66d27a5ee 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -63,7 +63,7 @@ See the full changelog at https://github.com/bUnit-dev/bUnit/releases - + diff --git a/src/bunit.web/Extensions/InputFile/InputFileExtensions.cs b/src/bunit.web/Extensions/InputFile/InputFileExtensions.cs index 39c6d7395..1611c3772 100644 --- a/src/bunit.web/Extensions/InputFile/InputFileExtensions.cs +++ b/src/bunit.web/Extensions/InputFile/InputFileExtensions.cs @@ -38,9 +38,9 @@ public static void UploadFiles( uploadTask.GetAwaiter().GetResult(); } - if (uploadTask.Exception is { InnerException: not null } e) + if (uploadTask.Exception?.InnerException is IOException e) { - ExceptionDispatchInfo.Capture(e.InnerException).Throw(); + ExceptionDispatchInfo.Capture(e).Throw(); } } } diff --git a/src/bunit.web/JSInterop/InvocationHandlers/Implementation/VirtualizeJSRuntimeInvocationHandler.cs b/src/bunit.web/JSInterop/InvocationHandlers/Implementation/VirtualizeJSRuntimeInvocationHandler.cs index 59c80ac56..bfaf1c71c 100644 --- a/src/bunit.web/JSInterop/InvocationHandlers/Implementation/VirtualizeJSRuntimeInvocationHandler.cs +++ b/src/bunit.web/JSInterop/InvocationHandlers/Implementation/VirtualizeJSRuntimeInvocationHandler.cs @@ -47,9 +47,15 @@ protected internal override Task HandleAsync(JSRuntimeInvocation invocat if (!invocation.Identifier.Equals(JsFunctionsPrefix + "dispose", StringComparison.Ordinal)) { // Assert expectations about the internals of the component +#if !NET9_0_OR_GREATER Debug.Assert(invocation.Identifier.Equals(JsFunctionsPrefix + "init", StringComparison.Ordinal), "Received an unexpected invocation identifier from the component."); Debug.Assert(invocation.Arguments.Count == 3, "Received an unexpected amount of arguments from the component."); Debug.Assert(invocation.Arguments[0] is not null, "Received an unexpected null argument, expected an DotNetObjectReference instance."); +#else + Debug.Assert(invocation.Identifier.Equals(JsFunctionsPrefix + "init", StringComparison.Ordinal)); + Debug.Assert(invocation.Arguments.Count == 3); + Debug.Assert(invocation.Arguments[0] is not null); +#endif InvokeOnSpacerBeforeVisible(invocation.Arguments[0]!); diff --git a/src/bunit.web/Rendering/BunitHtmlParser.cs b/src/bunit.web/Rendering/BunitHtmlParser.cs index f56c008b4..6f8edb5f7 100644 --- a/src/bunit.web/Rendering/BunitHtmlParser.cs +++ b/src/bunit.web/Rendering/BunitHtmlParser.cs @@ -105,7 +105,11 @@ private static (IElement? Context, string? MatchedElement) GetParseContextFromTa int startIndex, IDocument document) { +#if !NET9_0_OR_GREATER Debug.Assert(document.Body is not null, "Body of the document should never be null at this point."); +#else + Debug.Assert(document.Body is not null); +#endif IElement? result = null; diff --git a/src/bunit.web/TestDoubles/Localization/PlaceholderStringLocalization.cs b/src/bunit.web/TestDoubles/Localization/PlaceholderStringLocalization.cs index 0424e0d53..2112326d5 100644 --- a/src/bunit.web/TestDoubles/Localization/PlaceholderStringLocalization.cs +++ b/src/bunit.web/TestDoubles/Localization/PlaceholderStringLocalization.cs @@ -17,7 +17,9 @@ public IEnumerable GetAllStrings(bool includeParentCultures) /// /// Will throw exception to prompt the user. /// +#pragma warning disable S2325 // "WithCulture" is public API and can't be changed public IStringLocalizer WithCulture(CultureInfo culture) +#pragma warning restore S2325 => throw new MissingMockStringLocalizationException(nameof(WithCulture), culture); /// diff --git a/tests/bunit.generators.tests/bunit.generators.tests.csproj b/tests/bunit.generators.tests/bunit.generators.tests.csproj index 236bac0a1..eb1708596 100644 --- a/tests/bunit.generators.tests/bunit.generators.tests.csproj +++ b/tests/bunit.generators.tests/bunit.generators.tests.csproj @@ -15,8 +15,8 @@ - - + + diff --git a/tests/bunit.testassets/XunitExtensions/RepeatAttribute.cs b/tests/bunit.testassets/XunitExtensions/RepeatAttribute.cs index 71e49829e..7ced47dc8 100644 --- a/tests/bunit.testassets/XunitExtensions/RepeatAttribute.cs +++ b/tests/bunit.testassets/XunitExtensions/RepeatAttribute.cs @@ -3,6 +3,7 @@ namespace Xunit; +[AttributeUsage(AttributeTargets.Method, AllowMultiple = true, Inherited = true)] public sealed class RepeatAttribute : DataAttribute { public int Count { get; } diff --git a/tests/bunit.testassets/bunit.testassets.csproj b/tests/bunit.testassets/bunit.testassets.csproj index d9746eafc..07c94fb4a 100644 --- a/tests/bunit.testassets/bunit.testassets.csproj +++ b/tests/bunit.testassets/bunit.testassets.csproj @@ -14,8 +14,8 @@ - - + + diff --git a/tests/bunit.web.tests/TestDoubles/NavigationManager/FakeNavigationManagerTest.cs b/tests/bunit.web.tests/TestDoubles/NavigationManager/FakeNavigationManagerTest.cs index e8a274fab..ca09b9423 100644 --- a/tests/bunit.web.tests/TestDoubles/NavigationManager/FakeNavigationManagerTest.cs +++ b/tests/bunit.web.tests/TestDoubles/NavigationManager/FakeNavigationManagerTest.cs @@ -356,7 +356,7 @@ protected override void BuildRenderTree(RenderTreeBuilder builder) builder.CloseComponent(); } - private void InterceptNavigation(LocationChangingContext context) + private static void InterceptNavigation(LocationChangingContext context) { throw new NotSupportedException("Don't intercept"); } From 5d1165b3076ba0f55bc3ecaeb3d85c2d2e6bbe25 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 16 Aug 2024 14:40:31 +0000 Subject: [PATCH 3/4] build(deps): Bump Nerdbank.GitVersioning from 3.6.139 to 3.6.141 (#1516) Bumps [Nerdbank.GitVersioning](https://github.com/dotnet/Nerdbank.GitVersioning) from 3.6.139 to 3.6.141. - [Release notes](https://github.com/dotnet/Nerdbank.GitVersioning/releases) - [Commits](https://github.com/dotnet/Nerdbank.GitVersioning/compare/v3.6.139...v3.6.141) --- updated-dependencies: - dependency-name: Nerdbank.GitVersioning dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- src/bunit.generators/bunit.generators.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bunit.generators/bunit.generators.csproj b/src/bunit.generators/bunit.generators.csproj index dd92ab878..dc358a049 100644 --- a/src/bunit.generators/bunit.generators.csproj +++ b/src/bunit.generators/bunit.generators.csproj @@ -80,6 +80,6 @@ runtime; build; native; contentfiles; analyzers - + From f1246689734da0ef04c27084ee6ca551e6245370 Mon Sep 17 00:00:00 2001 From: bUnit bot Date: Fri, 16 Aug 2024 14:41:12 +0000 Subject: [PATCH 4/4] Set version to '1.31' --- version.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.json b/version.json index d009bb001..64c0ce06b 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/main/src/NerdBank.GitVersioning/version.schema.json", - "version": "1.31-preview", + "version": "1.31", "assemblyVersion": { "precision": "revision" },