For the following generic method in a non-generic C# class, VA invents an class variable that actually is an local variable in the generic method.
I can send you the source file in case you cant repro this. Here is a very simplified version.
public sealed class HardwareManager : ISupportShutdown, IDisposable
{
public T GetDeviceByType<T>(string deviceType) where T : class
{
var list = GetDeviceByType(deviceType);
if(list.Any())
{
return list.First().Device as T;
}
return null;
}
public ImmutableList<HardwareDevice> GetDeviceByType(string deviceType)
{
return new List<HardwareDevice>().ToImmutableList();
}
}
public class HardwareDevice { }