If I try and create a generic class and use it as a Feed property on my model, the code generation for the model fails with:
CSC : warning CS8785: Generator 'FeedsGenerator' failed to generate source. It will not contribute to the output and compilation errors may occur as a result. Exception was of type 'ArgumentException' with message 'The hintName 'mvuxtestapp.Presentation.Iterator.g.cs' contains an invalid character '<' at position 33. (Parameter 'hintName')'. [/Users/steve/src/TestApps/mvuxtestapp/mvuxtestapp/mvuxtestapp.csproj]
/Users/steve/src/TestApps/mvuxtestapp/mvuxtestapp/Presentation/MainModel.cs(21,81): warning CS8603: Possible null reference return. [/Users/steve/src/TestApps/mvuxtestapp/mvuxtestapp/mvuxtestapp.csproj]
My Model:
namespace mvuxtestapp.Presentation;
public partial record MainModel
{
private INavigator _navigator;
public MainModel(
IStringLocalizer localizer,
IOptions<AppConfig> appInfo,
INavigator navigator)
{
_navigator = navigator;
Title = "Main";
Title += $" - {localizer["ApplicationName"]}";
Title += $" - {appInfo?.Value?.Environment}";
}
public string? Title { get; }
public IState<string> Name => State<string>.Value(this, () => string.Empty);
public IState<Iterator<int>> Test => State<Iterator<int>>.Value(this, () => null);
public async Task GoToSecond()
{
var name = await Name;
await _navigator.NavigateViewModelAsync<SecondModel>(this, data: new Entity(name!));
}
}
public record Iterator<T>(IImmutableList<T> Items)
{
public int CurrentIndex { get; init; } = 0;
public T CurrentItem => Items[CurrentIndex];
public int Count => Items.Count;
public bool CurrentIsLast => CurrentIndex == Items.Count - 1;
public bool CanMoveNext => CurrentIndex < Items.Count - 1;
public bool CanMovePrevious => CurrentIndex > 0;
public Iterator<T> MoveNext()
=> CanMoveNext
? this with { CurrentIndex = CurrentIndex + 1 }
: this;
public Iterator<T> MovePrevious()
=> CanMovePrevious
? this with { CurrentIndex = CurrentIndex - 1 }
: this;
}
If I try and create a generic class and use it as a Feed property on my model, the code generation for the model fails with:
My Model:
mvuxtestapp.zip