Repository navigation
Register each generator once when AddCoder is called twice [patch] - #198
Merged
Merged
Conversation
AddLanguageGenerators appended a descriptor per call, so calling AddCoder from both a library and its host resolved fourteen generators and the documented .Single(g => g.LanguageId == ...) lookup threw. Register the generators with TryAddEnumerable and the serializers with TryAddSingleton, and make the idempotency test assert one registration of each. Fixes #150 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ACXyQBPWSqFJuF51Mx6FNh
|
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.



Fixes #150
What changed
AddLanguageGeneratorsnow registers each generator withTryAddEnumerable(ServiceDescriptor.Singleton<ILanguageGenerator, …>()). CallingAddCoder()twice, say once from a library and once from the host, used to resolve 14 generators. That made the documented.Single(g => g.LanguageId == …)selection throw and showed every language twice in the editor.AddCoderSerializationusesTryAddSingletonfor the serializer and deserializer.AddCoder_ShouldBeIdempotentused to assert onlyCount > 0. It now asserts exactly 7 generators, thatSinglebyLanguageIdsucceeds for each of them, and exactly one serializer and one deserializer.Verification
Assert.HasCount(7, generators)). With the fix in place, it passes.Coder.Testsuite: 1100 passed, 0 failed.🤖 Generated with Claude Code
https://claude.ai/code/session_01ACXyQBPWSqFJuF51Mx6FNh
Generated by Claude Code