To Reproduce
Run the following test code:
var code =
"""
#nullable enable
using Rocks;
using System;
using System.Collections.Generic;
[assembly: Rock(typeof(ISourceUpdater<,>), BuildType.Create)]
public interface ICacheUpdater<TObject, TKey>
where TObject : notnull
where TKey : notnull
{
void Refresh(IEnumerable<TKey> keys);
}
public interface ISourceUpdater<TObject, TKey>
: ICacheUpdater<TObject, TKey>
where TObject : notnull
where TKey : notnull
{
void AddOrUpdate(TObject item);
void Refresh(IEnumerable<TObject> items);
}
""";
Expected behavior
Mock code is generated as expected.
Actual behavior
A diagnostic is created:
// Rocks\Rocks.RockGenerator\ISourceUpdaterTObject, TKey_Rock_Create.g.cs(48,5): error CS0535:
'ISourceUpdaterCreateExpectations<TObject, TKey>.Mock' does not implement interface member 'ICacheUpdater<TObject, TKey>.Refresh(IEnumerable<TKey>)'
Additional context
The base Refresh() method uses TKey, and the derived class uses TObject, so both should be implemented, but Rocks is getting confused and ignoring the base type.
This was found on DynamicData.ISourceUpdater<,>.
To Reproduce
Run the following test code:
Expected behavior
Mock code is generated as expected.
Actual behavior
A diagnostic is created:
Additional context
The base
Refresh()method usesTKey, and the derived class usesTObject, so both should be implemented, but Rocks is getting confused and ignoring the base type.This was found on
DynamicData.ISourceUpdater<,>.