Repository navigation
Report generator failures as DM0001, and make log and file names unique - #95
Merged
Merged
Conversation
GetFileNameHint removed the root namespace from every name, so App.Sub.FooModule and Sub.FooModule both got Sub.FooModule.Module.g.cs. A name outside the root namespace now starts with "global-". A namespace cannot contain '-', so no shortened name can match it. A log file name was the stage name and the time in milliseconds. The two outputs of a stage often finish in the same millisecond, so one log replaced the other. Each name now ends with a random part, and the diagnostics output of a stage logs under its own name. The module writer and the three outputs that only report diagnostics had no handler. An exception there gave CS8785, and Roslyn then dropped every generated file. They now log the exception and report DM0001. The module writer does this per module, so one failure does not remove the code of the other modules. Cancellation is not reported as a failure. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
ipjohnson
added a commit
that referenced
this pull request
Sep 24, 2026
* Update the docs for the fixes to issues #63 to #94 The warnings and limits that described the defects are removed or corrected, and the pages now describe the behavior of PRs #95 to #111. DM0023, DM0024 and DM0025 get entries in the diagnostics reference. The package description of DependencyModules.SourceGenerator.Impl no longer tells the reader to add CSharpAuthor. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Describe Implementation decorators with generated factories, and retire DM0022 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Ian Johnson <ianjohnson@mac.mynetworksettings.com> Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
ipjohnson
added a commit
that referenced
this pull request
Sep 24, 2026
…113) * Rewrite the README and documentation in Simplified Technical English The new text follows ASD-STE100 Issue 9. It was written from the source code, not from the previous documentation. All C# samples compile, and the samples that can run were run. A separate review checked each claim against the source. This removes the pages guide/scanning, guide/testing-registrations, reference/conventions-api, and reference/interfaces. It adds guide/testing-container-source and reference/api. The nine package descriptions are also rewritten. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Point .git-blame-ignore-revs at the CSharpier commit on main 79a2881 is not in the history of main. The squash merge of #62 made d7a1a82, which is the reformat commit on main. With the old hash, git blame still gave 53 lines of ModuleEnvironment.cs to the reformat. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Update the docs for the fixes to issues #63 to #94 (#112) * Update the docs for the fixes to issues #63 to #94 The warnings and limits that described the defects are removed or corrected, and the pages now describe the behavior of PRs #95 to #111. DM0023, DM0024 and DM0025 get entries in the diagnostics reference. The package description of DependencyModules.SourceGenerator.Impl no longer tells the reader to add CSharpAuthor. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Describe Implementation decorators with generated factories, and retire DM0022 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Ian Johnson <ianjohnson@mac.mynetworksettings.com> Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Document three service registration limits found during the fixes A keyed factory method, TryEnumerable for a registration whose implementation is its service type, and a class with only internal constructors all fail at run time with no diagnostic. No issue tracks them yet. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Restore the CSharpAuthor packing in DependencyModules.SourceGenerator.Impl The merge of main took this branch's whole project file to keep its description, which dropped what #103 added: GeneratePathProperty on CSharpAuthor and the items that pack its sources. The project file now matches main except for the description. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Ian Johnson <ianjohnson@mac.mynetworksettings.com> Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Closes #84. Closes #90. Closes #94.
An exception in any output of the generator is now reported as DM0001. Before this, four of the eight outputs had no handler. An exception there gave CS8785, and Roslyn removed all generated code. Log files no longer replace each other, and two modules can no longer get the same generated file name.
#94: file names
GetFileNameHintremoves the root namespace, soApp.Sub.FooModuleandSub.FooModuleboth gotSub.FooModule.Module.g.cs. A name outside the root namespace now starts withglobal-, for exampleglobal-Sub.FooModule.Module.g.cs. A namespace cannot contain-, so no shortened name can match it.The names of types under the root namespace do not change. A type in the global namespace changes from
global.Xtoglobal-X, because a typeXin the namespaceApp.globalalso gotglobal.X.#90: log files
Each log file name now ends with 8 random hex characters after the time. The diagnostics output of each stage logs as
<Stage>.Diagnostics. Thus theServiceSourceGeneratorlog is again the one with the configuration, the modules and the services.#84: DM0001 for every output
These outputs now run inside
FileLogger.Wrap:ModuleEntryPointDiagnostics(DM0003, DM0017, DM0018)AssemblyModuleAttributeDiagnostics(DM0016, DM0019)TestAttributeDiagnostics(DM0021)A new
FileLogger.Wrapoverload takes theSourceProductionContextand reports DM0001. The four outputs that already reported DM0001 use it too. The module writer catches per module, so a module that fails does not remove the code of the others.OperationCanceledExceptionis not caught, because it is Roslyn stopping the run.TestAttributeDiagnosticsnow reads the configuration to find the log folder, because a test project often declares no module to take it from.BaseSourceGenerator.CreateConfigurationValueProviderisinternal staticfor this.With #94 fixed, the repro in #84 no longer fails. The test for #84 gives the module writer a module whose name Roslyn refuses as a hint name.
Public API
Two members are added to the
DependencyModules.SourceGeneratorAPI:DependencyModuleDiagnostics.GeneratorFailureFrom(Exception)and the newFileLogger.Wrapoverload. Nothing is removed.Docs
The warnings for #84 and #90 are on
docs-ste-rewrite, introubleshooting.mdanddiagnostics.md. That branch is not on main, so this PR does not change them. They will be removed in one docs pass after the fixes.Verified
dotnet csharpier check .is clean.scripts/coverage.shorscripts/verify-packages.shlocally. CI runs both.🤖 Generated with Claude Code