i have component WHERE T can be int or int? with params like
@typeparam T
@inject DictService _dhttp;
<MudAutocomplete T="string" @bind-Value="ValueString" Label="@Label" For="()=>ValueString" SearchFunc="@SearchFunc" 
             ResetValueOnEmptyText="true" CoerceValue="true" 
             OpenIcon="@Icons.Material.Filled.Search" AdornmentColor="Color.Primary"
             @attributes=AllOtherAttributes />
[Parameter]
public Expression<Func<T>>? For { get; set; }
[Parameter]
public string? Label { get; set; }
private T _value = default!;
[Parameter]
public T Value
{
    get => _value;
    set
    {
        if (!Equals(value, _value))
        {
            _value = value;
            if (ValueChanged.HasDelegate) ValueChanged.InvokeAsync(_value);
        }
    }
}
[Parameter]
public EventCallback<T?> ValueChanged { get; set; } 
private string? _valueString ;
public string? ValueString 
{
    get{
        return _valueString!;
    }
    set
    {
        if(!Equals(value, _valueString))
        {
            _valueString = value;
            int? valueInt = _dict!.Values.Where(... some logic to get in val or not)
            if (valueInt is null)
            {
                ValueString = null;
and now this should work for both cases?!? set 0 if int and null if int? ??
this.Value = (T)(object)default!;
but instead of i have to do
              if (typeof(T) == typeof(int))
                   this.Value = (T)(object)0; 
               else
                    this.Value = (T)(object)default!;
            }
            else this.Value = (T)(object)valueInt;           
            if (ValueChanged.HasDelegate)  ValueChanged.InvokeAsync(_value);
        }
    }
}
if i do not do this way then in debug i see that if T is int then (T)(object)default! like crashes? it should set it to 0 !?
it throws no error. it not go to next line , it just returns to app without changing value of this.Value witch is int in this case. value stays as it was from previous run
is it a .net blazor bug? or am missing something here ?
Here is some githup repo that shows this issue
https://github.com/d00lar/TconverterFails
in this line
 <MudSelectItem  Value="TConverter.ChangeType<T>(item.Key)">@item.Value</MudSelectItem>
if i do casting based on this int/int? switch then it will wotk fine otherwise throw as in topic
 
    