You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Generators: every generated TryParse(string?, IFormatProvider?, out) ends in unreachable code #100
area/parsingParse, TryParse, formatting and the type converterbugSomething isn't workingpackage/generatorsAffects CodoMetis.TypeKit.Generatorsseverity/lowCosmetic, message or documentation-level difference
Every generated TryParse(string?, IFormatProvider?, out TSelf) ends with unreachable code after its return: a declaration of __inner and a try/catch (FormatException) that assigns it. From the woven OrderId of the samples (obj/…/metalama/Root/IntroSamples.cs), trimmed:
The same tail is in the probes' woven code (ProbeId) and in every value object with parsing, so it is not an artefact of a test framework. It came up while reading the expected files of the AspectTesting spike (#93).
Cause
TryParseTemplate in src/CodoMetis.TypeKit.Generators/ValueObjectParsableAspect.Templates.cs returns from a compile-time if (the InnerTryParse and string branches), and the two meta.InsertStatement calls after it are still emitted into the run-time body.
Effect
None at run time: the code is unreachable, and the compiler emits no IL for it. It makes every generated TryParse longer and confusing to read, which matters now that the READMEs show generated code (#92), and a reviewer reading the woven code is led to look for a path that does not exist.
Done when
The generated TryParse ends at its return, for every parse strategy (StaticParse, StringConstructor, string, enum, NodaTime).
The generated-surface snapshot is unchanged (it lists members, not bodies), and a test reads the woven file and fails on a statement after the final return, shown to fail with the fix reverted.
Fixed in PR #106: TryParseTemplate's branches are an if-else chain now, so the InsertStatements run only in the last one. WovenReachabilityTests (conventions) reads the probes' woven files and found 26 unreachable statements before the fix, none after. This closes by hand when #106 merges into release/2.3.0.
area/parsingParse, TryParse, formatting and the type converterbugSomething isn't workingpackage/generatorsAffects CodoMetis.TypeKit.Generatorsseverity/lowCosmetic, message or documentation-level difference
Activity
CaffeinatedCoder commentedon Oct 28, 2026
Fixed in PR #106:
TryParseTemplate's branches are an if-else chain now, so theInsertStatements run only in the last one.WovenReachabilityTests(conventions) reads the probes' woven files and found 26 unreachable statements before the fix, none after. This closes by hand when #106 merges into release/2.3.0.CaffeinatedCoder commentedon Oct 28, 2026
Done in PR #106, merged into release/2.3.0.