https://github.com/lordmike/mbw.generators
Repository with .NET source code generators
https://github.com/lordmike/mbw.generators
csharp dotnet roslyn source-generator
Last synced: 3 months ago
JSON representation
Repository with .NET source code generators
- Host: GitHub
- URL: https://github.com/lordmike/mbw.generators
- Owner: LordMike
- Created: 2021-04-23T09:43:46.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-10-12T20:44:24.000Z (almost 5 years ago)
- Last Synced: 2025-04-01T17:10:36.659Z (over 1 year ago)
- Topics: csharp, dotnet, roslyn, source-generator
- Language: C#
- Homepage:
- Size: 20.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MBW.Generators [](https://github.com/LordMike/MBW.Generators/actions/workflows/dotnet.yml)
A small collection of Roslyn source generators.
Each generator ships as a single NuGet package containing both the generator
and its attributes. Install the package to get the annotations and run the
generator, or reference it with `all` if you
only need the attributes.
## Generators
| Generator | Description |
|-----------|-------------|
| [NonTryMethods](src/Generators/NonTryMethods.Generator/README.md#readme) [](https://www.nuget.org/packages/MBW.Generators.NonTryMethods) | Creates non-try wrappers for Try-pattern methods |
| [OverloadGenerator](src/Generators/OverloadGenerator.Generator/README.md#readme) [](https://www.nuget.org/packages/MBW.Generators.OverloadGenerator) | Generates overloads based on declarative attributes |
| [GeneratorHelpers](src/Generators/GeneratorHelpers.Generator/README.md#readme) [](https://www.nuget.org/packages/MBW.Generators.GeneratorHelpers) | Generates allocation-free Roslyn symbol helpers |
Here’s a reviewed + extended version of your README snippet. I’ve tightened wording, added a bit of background and practical guidance, and included caveats / tips that future you (or consumers) will appreciate:
---
## Logging
All analyzers in this package share a **common, opt-in logger** for troubleshooting.
By default, logging is **disabled** and analyzers are completely silent.
### Enabling logging
You can turn it on via `.editorconfig` in the root of your solution or project:
```ini
# Enable/disable (default: false)
mbw_generators_logging_enabled = true
# Optional: override the pipe name (default: MBW.Generators.Log)
mbw_generators_logging_pipeName = MBW.Generators.Log
```
Once enabled, analyzers will attempt to connect to a named pipe.
The default pipe name is `MBW.Generators.Log`.
### Viewing logs
Start the `Tool.LogReader` project before making edits in your IDE.
As soon as the analyzers connect, log messages will begin streaming in.
Typical workflow:
1. Launch `Tool.LogReader` (standalone console project).
2. Open your solution in Visual Studio / Rider / `dotnet build`.
3. Perform edits or builds — the analyzer will write trace messages into the log reader window.
### Notes & caveats
* **Best effort only**: if the logger cannot connect to the pipe, it silently disables itself for the rest of the session (no retries).
* **Zero overhead when off**: when `mbw_generators_logging_enabled = false` (the default), log codepaths are completely skipped.
* **Local runs only**: this logger is intended for troubleshooting and development. Do not enable it in CI builds unless you explicitly want the output.