ILSpy icon indicating copy to clipboard operation
ILSpy copied to clipboard

Missing nullable annotation for generic base type

Open rafal-mz opened this issue 3 years ago • 0 comments

Input code

public class Test : Test<KeyValuePair<int, object?>>
{
}

public class Test<T> : IList<T>
{
    public T this[int index] { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }

    public int Count => throw new NotImplementedException();

    public bool IsReadOnly => throw new NotImplementedException();

    public void Add(T item)
    {
        throw new NotImplementedException();
    }

    public void Clear()
    {
        throw new NotImplementedException();
    }

    public bool Contains(T item)
    {
        throw new NotImplementedException();
    }

    public void CopyTo(T[] array, int arrayIndex)
    {
        throw new NotImplementedException();
    }

    public IEnumerator<T> GetEnumerator()
    {
        throw new NotImplementedException();
    }

    public int IndexOf(T item)
    {
        throw new NotImplementedException();
    }

    public void Insert(int index, T item)
    {
        throw new NotImplementedException();
    }

    public bool Remove(T item)
    {
        throw new NotImplementedException();
    }

    public void RemoveAt(int index)
    {
        throw new NotImplementedException();
    }

    IEnumerator IEnumerable.GetEnumerator()
    {
        throw new NotImplementedException();
    }
}

Erroneous output

I expected base type to have nullable object type in the output. It is skipped though. image

Details

Assembly compiled with .NET 6.0.400 Decompiled with ILSpy extension for VS Studio:

image

I've got the same output when using ICSharpCode.Decompiler 7.2.0.6844.

rafal-mz avatar Sep 12 '22 18:09 rafal-mz