Conversation
…8602) Two tests from ZL154#193 read inject.js through ResourceReader.ReadEmbeddedText, which returns string?, and dereferenced the result without a null check, which is four CS8602 warnings on every build of the test project. Each now asserts the resource is present first, like the rest of the suite does.
This was referenced Sep 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two tests in
Jellyfin12ShellTests.cs(mine, from #193) readinject.jsthroughResourceReader.ReadEmbeddedText, which returnsstring?, and went straight toIndexOfon the result. With<Nullable>enable</Nullable>that is fourCS8602warnings on every build of the test project. Each test now asserts the resource is present before using it, the way the file's third test andAdminPageContractTestsalready do.Type of change
Related issues
Follow-up to #193, noted in #201.
How was this tested?
Assert.NotNull(js)linesTest-only change.
dotnet build tests/Jellyfin.Plugin.TwoFactorAuth.Tests -c Release: zero warnings (fourCS8602before).dotnet test -c Release: 502 passed, 0 failed.What changed
tests/Jellyfin.Plugin.TwoFactorAuth.Tests/Jellyfin12ShellTests.cs:Assert.NotNull(js);after the twoReadEmbeddedTextcalls. xunit'sAssert.NotNullcarries the[NotNull]annotation, so the compiler treatsjsas non-null from there on, and a missing embedded resource now fails the test with a clear message instead of aNullReferenceException.Checklist
dotnet formatif unsure)dotnet build+dotnet testgreen)Screenshots / log slices
Additional notes
None.