MudX Maintenance - Sln to Slnx, api json references, AI files, editorconfig#59
MudX Maintenance - Sln to Slnx, api json references, AI files, editorconfig#59versile2 wants to merge 8 commits intoMudXtra:devfrom
Conversation
- Added deterministic property ordering to JSON serialization by setting `PropertyNamingPolicy` and `DictionaryKeyPolicy` to `null` in `JsonSerializerOptions`. - Introduced `NormalizeJson` to standardize JSON formatting (normalize line endings and trim trailing whitespace). - Updated `WriteIfDifferent` to use normalized JSON for comparisons, reducing false positives for changes. - Added a special case for `LottiePlayer.ElementId` to ensure its default value is always `lottie-[auto-generated]`. - Updated `LottiePlayer.api.json` to reflect the new default value for `ElementId`. - Improved exception handling and logging in `WriteIfDifferent`. - Enhanced code readability with comments explaining new logic.
Introduced a `.editorconfig` file to enforce consistent coding style, including indentation, naming conventions, and analyzer rules. Added `AGENTS.md` as a project-specific guide for AI coding agents, detailing best practices, project structure, and contribution guidelines. Updated `MudX.sln` to include `.editorconfig` and Markdown files. Enhanced `AGENTS.md` with rules for component development, testing, documentation, and handling breaking changes. Emphasized adherence to `.editorconfig` and the importance of running `dotnet format` for changed files. These changes standardize coding practices, improve project organization, and ensure high-quality contributions.
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces significant infrastructure and documentation improvements to the MudX codebase. By migrating to the Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces several maintenance improvements, including migrating the solution to the modern .slnx format, adding an .editorconfig for consistent styling, and making API documentation generation deterministic. The changes are generally well-implemented. I've added a few comments with suggestions for minor code quality improvements and to point out a style violation according to the newly introduced AGENTS.md guide.
| object? instance = null; | ||
| if (type != null) | ||
| instance = Activator.CreateInstance(type); |
There was a problem hiding this comment.
Pull request overview
Maintenance update to modernize the MudX solution/workspace setup and improve generated API documentation artifacts (JSON/XML) while aligning repo style/tooling through new editor/agent config files.
Changes:
- Added a new
MudX.slnxsolution format and updated related solution item organization. - Updated API docs generation to normalize output and reduce noisy diffs (line ending/trailing whitespace normalization, default value handling tweaks).
- Added repo-wide
.editorconfigand anAGENTS.mdguide; applied formatting/encoding touch-ups across several files.
Reviewed changes
Copilot reviewed 14 out of 22 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/MudX.UnitTests/Components/SheetTests.cs | Formatting-only (closing brace alignment). |
| tests/MudX.UnitTests/Components/CopyToClipboardTests.cs | Formatting-only (closing brace alignment). |
| tests/MudX.UnitTests/Components/CodeBlockTests.cs | Formatting-only (closing brace alignment). |
| tests/MudX.UnitTests.Viewer/Program.cs | Adds UTF-8 BOM / formatting normalization for using directive line. |
| src/MudX.slnx | Introduces the .slnx solution definition with solution folders and project references. |
| src/MudX.sln.bak | Updates a backup .sln artifact content (VisualStudioVersion + solution items). |
| src/MudX.Generator/StaticAssetsFileMethods.cs | Formatting-only (closing brace alignment). |
| src/MudX.Generator/JavaScriptCompressor.cs | Formatting-only (closing brace alignment). |
| src/MudX.Docs/wwwroot/api/Mudblazor.xml | Updates cached MudBlazor XML docs content used for API descriptions. |
| src/MudX.Docs/wwwroot/api/LottiePlayerModule.api.json | Updates generated API JSON output (notably null descriptions). |
| src/MudX.Docs/wwwroot/api/LottiePlayer.api.json | Updates generated API JSON output (default value normalization + null description). |
| src/MudX.Docs/wwwroot/api/Blazor.Lottie.Player.xml | Updates cached LottiePlayer XML docs content used for API descriptions. |
| src/MudX.Docs/Shared/MudXTextFieldSearch.razor.cs | Adds UTF-8 BOM / formatting normalization + trailing brace alignment. |
| src/MudX.Docs/Data/VersionsList.cs | Minor whitespace cleanup in dependency version list. |
| src/MudX.Docs/Components/Examples/ChatAvatarExample.g.cs | Updates docs example markup and adds an inline style snippet. |
| src/MudX.Docs.Server/Program.cs | Adds UTF-8 BOM / formatting normalization for using directive line. |
| src/MudX.Docs.Hybrid/MudX.Docs.Hybrid/Program.cs | Adds UTF-8 BOM / formatting normalization for using directive line. |
| src/MudX.Docs.Hybrid/MudX.Docs.Hybrid.Client/Program.cs | Adds UTF-8 BOM / formatting normalization for using directive line. |
| src/MudX.Docs.Generator/ExampleSource.cs | Formatting-only (closing brace alignment). |
| src/MudX.Docs.Generator/ApiSource.cs | Normalizes generated API JSON and tweaks default handling; attempts to improve determinism. |
| AGENTS.md | Adds project-specific AI coding agent guidance and conventions. |
| .editorconfig | Adds repo-wide code style, encoding, analyzers, and header conventions. |
Comments suppressed due to low confidence (1)
src/MudX.sln.bak:5
- This looks like an IDE-generated backup artifact (.sln.bak). Since nothing in the repo references it, keeping it tracked can confuse tooling and reviewers. Consider removing it from source control (and/or adding a gitignore rule) once the .slnx migration is complete.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| var jsonOptions = new JsonSerializerOptions { WriteIndented = true }; | ||
| // Ensure deterministic property order | ||
| jsonOptions.PropertyNamingPolicy = null; | ||
| jsonOptions.DictionaryKeyPolicy = null; | ||
|
|
There was a problem hiding this comment.
The comment says this ensures deterministic JSON, but setting PropertyNamingPolicy/DictionaryKeyPolicy to null is already the default and doesn't address the main non-determinism risk here (reflection enumeration order for types/properties/methods). To make output deterministic across runtimes, sort the component list and member lists (e.g., by FullName/Name/signature) before serializing, and consider removing or rewording this comment if ordering isn't actually guaranteed.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Signed-off-by: Versile Johnson II <148913404+versile2@users.noreply.github.com>
Simplify JSON writing and instance creation logic Removed the `NormalizeJson` step before writing serialized JSON to files, directly using the serialized output in `WriteIfDifferent`. This eliminates unnecessary normalization. Simplified instance creation by removing redundant null checks before calling `Activator.CreateInstance`, relying on its built-in behavior to handle null cases. These changes improve code clarity and maintainability.
Summary
This maintenance PR includes several improvements and updates across the MudX codebase:
• Solution Format Modernization:
• All references to MudX.sln have been updated to use the new .slnx format for improved compatibility and future-proofing.
• API JSON Documentation:
• Generator projects now ensure deterministic and normalized API JSON output, with improved handling for component summaries, parameters, events, and default values.
• Null reference warnings in API source generation have been resolved.
• AI/Editor Files:
• Added and/or updated AI-related files and .editorconfig for consistent code style and tooling support.
• General Maintenance:
• Minor code cleanups, improved error handling, and updated project references as needed.
Details
• Refactored code in ApiSource.cs to prevent null reference warnings and ensure robust API documentation generation.
• Searched and replaced .sln references in documentation, build scripts, and project files.
• Verified and updated MudX.csproj files for both Generator projects.
• Ensured workspace and repository are aligned with new solution standards and tooling.