Skip to content

fix: cref-reference in gernerated XML-documentation for inherited members#594

Merged
vbreuss merged 2 commits into
mainfrom
topic/fix-cref-reference-for-inherited-members
Mar 28, 2026
Merged

fix: cref-reference in gernerated XML-documentation for inherited members#594
vbreuss merged 2 commits into
mainfrom
topic/fix-cref-reference-for-inherited-members

Conversation

@vbreuss

@vbreuss vbreuss commented Mar 28, 2026

Copy link
Copy Markdown
Member

Fixes XML documentation <see cref="..."> targets in generated mock code so inherited interface members reference their declaring (containing) type, and adds a regression test to lock in the behavior.

Key Changes:

  • Update generated XML doc cref targets for properties/methods/indexers/events to use each member’s ContainingType rather than the mock’s class name.
  • Add a source-generator test covering inherited interface members’ XML documentation references.

@vbreuss vbreuss self-assigned this Mar 28, 2026
Copilot AI review requested due to automatic review settings March 28, 2026 06:55
@vbreuss vbreuss added the bug Something isn't working label Mar 28, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes XML documentation <see cref="..."> targets in generated mock code so inherited interface members reference their declaring (containing) type, and adds a regression test to lock in the behavior.

Changes:

  • Update generated XML doc cref targets for properties/methods/indexers/events to use each member’s ContainingType rather than the mock’s class name.
  • Add a source-generator test covering inherited interface members’ XML documentation references.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
Tests/Mockolate.SourceGenerators.Tests/MockTests.ClassTests.cs Adds a regression test asserting correct cref references for inherited interface members.
Source/Mockolate.SourceGenerators/Sources/Sources.MockClass.cs Adjusts XML doc generation to reference the declaring type (ContainingType) for inherited members.

Comment thread Source/Mockolate.SourceGenerators/Sources/Sources.MockClass.cs Outdated
Comment thread Source/Mockolate.SourceGenerators/Sources/Sources.MockClass.cs Outdated
Comment thread Source/Mockolate.SourceGenerators/Sources/Sources.MockClass.cs
Comment thread Source/Mockolate.SourceGenerators/Sources/Sources.MockClass.cs Outdated
Comment thread Source/Mockolate.SourceGenerators/Sources/Sources.MockClass.cs Outdated
@github-actions

github-actions Bot commented Mar 28, 2026

Copy link
Copy Markdown

Test Results

    21 files  ±0      21 suites  ±0   4m 29s ⏱️ +11s
 2 858 tests +1   2 857 ✅ +1  1 💤 ±0  0 ❌ ±0 
19 197 runs  +3  19 196 ✅ +3  1 💤 ±0  0 ❌ ±0 

Results for commit 0fcfc18. ± Comparison against base commit 089562f.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Mar 28, 2026

Copy link
Copy Markdown

🚀 Benchmark Results

Details

BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.4 LTS (Noble Numbat)
AMD EPYC 7763 2.45GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.201
[Host] : .NET 10.0.5 (10.0.5, 10.0.526.15411), X64 RyuJIT x86-64-v3

Job=InProcess Toolchain=InProcessEmitToolchain IterationCount=15
LaunchCount=1 WarmupCount=10

Method Mean Error StdDev Gen0 Gen1 Allocated
Event_Mockolate 668.2 ns 20.75 ns 19.41 ns 0.1497 0.0010 2.46 KB
Event_Moq 11,787.9 ns 110.99 ns 98.39 ns 0.5493 - 9.69 KB
Event_NSubstitute 4,824.2 ns 36.04 ns 31.94 ns 0.5112 0.0076 8.4 KB
Event_FakeItEasy 193,024.5 ns 1,706.15 ns 1,595.93 ns 0.4883 0.2441 10.3 KB
Event_Imposter 1,000.2 ns 26.05 ns 24.37 ns 0.5093 0.0134 8.34 KB
Event_TUnitMocks 2,470.9 ns 144.29 ns 134.97 ns 0.2785 0.0057 4.55 KB
Indexer_Mockolate 1,324.0 ns 8.71 ns 8.15 ns 0.2747 0.0019 4.5 KB
Indexer_Moq 191,358.8 ns 1,108.91 ns 1,037.27 ns 0.7324 0.4883 14.56 KB
Indexer_NSubstitute 5,954.1 ns 51.79 ns 43.25 ns 0.5722 - 9.41 KB
Indexer_FakeItEasy 6,428.6 ns 16.18 ns 13.51 ns 0.4883 0.0153 7.98 KB
Indexer_Imposter 765.8 ns 9.29 ns 8.69 ns 0.2928 0.0048 4.8 KB
Method_Mockolate 981.7 ns 12.06 ns 10.69 ns 0.2117 - 3.47 KB
Method_Moq 190,203.0 ns 1,024.63 ns 958.44 ns 0.7324 0.4883 14.58 KB
Method_NSubstitute 5,742.6 ns 43.43 ns 38.50 ns 0.5493 0.0076 9.09 KB
Method_FakeItEasy 6,544.9 ns 9.69 ns 8.09 ns 0.4883 0.0153 8 KB
Method_Imposter 718.4 ns 7.90 ns 7.39 ns 0.2537 0.0029 4.15 KB
Method_TUnitMocks 2,628.2 ns 10.92 ns 9.68 ns 0.4005 0.0076 6.55 KB
Property_Mockolate 980.0 ns 6.50 ns 6.08 ns 0.1984 - 3.25 KB
Property_Moq 4,813.8 ns 24.59 ns 23.00 ns 0.3281 - 5.47 KB
Property_NSubstitute 5,051.2 ns 27.95 ns 24.77 ns 0.5188 0.0076 8.58 KB
Property_FakeItEasy 4,645.2 ns 20.58 ns 19.25 ns 0.3815 0.0153 6.29 KB
Property_Imposter 394.5 ns 7.18 ns 6.36 ns 0.1783 0.0019 2.91 KB
Property_TUnitMocks 1,992.7 ns 8.94 ns 7.47 ns 0.3319 0.0076 5.47 KB

@vbreuss vbreuss enabled auto-merge (squash) March 28, 2026 10:31
@sonarqubecloud

Copy link
Copy Markdown

@vbreuss vbreuss merged commit 9803246 into main Mar 28, 2026
12 checks passed
@vbreuss vbreuss deleted the topic/fix-cref-reference-for-inherited-members branch March 28, 2026 10:37
@github-actions

Copy link
Copy Markdown

This is addressed in release v2.1.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working state: released The issue is released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants