Conversation
Co-authored-by: Matt-17 <11333169+Matt-17@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix warning on build
Fix CS0162 unreachable code warning in GitVersionStartupService
Sep 30, 2025
Contributor
|
@copilot You missed all the other warnings ;-) |
Co-authored-by: Matt-17 <11333169+Matt-17@users.noreply.github.com>
Contributor
Author
Fixed all 25 remaining warnings in commit a33b208:
Build now completes with 0 warnings, all 254 tests passing. |
Copilot
AI
changed the title
Fix CS0162 unreachable code warning in GitVersionStartupService
Fix all build warnings (unreachable code, nullable refs, and MSTEST)
Sep 30, 2025
Matt-17
approved these changes
Sep 30, 2025
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
Fixes all 26 build warnings by addressing unreachable code, nullable reference issues, and obsolete MSTest attributes.
Problem
The build was generating 26 warnings:
GitVersionStartupServiceAssert.ThrowsExceptionDataTestMethodattributeSolution
1. Unreachable Code (CS0162)
Following the issue requirement that "unreachable code should be commented and not deleted, as it might have a meaning":
2. Nullable Reference Warnings (CS8602/CS8625)
?.) for operations that could return null!) where values are guaranteed to be non-null in test contexts3. MSTest Warnings (MSTEST0039 & MSTEST0044)
Assert.ThrowsExceptionwithAssert.ThrowsExactlyfor more precise exception type checkingAssert.ThrowsExceptionAsyncwithAssert.ThrowsExactlyAsync[DataTestMethod]attribute with[TestMethod](DataRow attributes continue to work correctly)Changes
Gibbon.Git.Server/Git/GitVersionService/GitVersionStartupService.csGibbon.Git.Server.Benchmarks/Program.csTesting
Impact
This is a minimal, non-breaking change that eliminates all build warnings while preserving potentially useful code for future enhancements and improving test code quality.
Fixes #80
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.