You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
REFL003 The type System.Collections.Generic.IEnumerable<object> does not have a member named Add.
The analyzer should bail if it sees a GetType() on an expression of a virtual type since it can know nothing about the expected concrete type which may be internal to an external lib.
Additionally, if it sees a GetType() on a nonvirtual type, maybe it should bail anyway because it will be reporting #169 in all these cases anyway.
Actual code, in case you wonder why you would do this:
publicstaticIReadOnlyCollection<Assembly> GetAssemblies(thisITypeDiscoveryServicetypeDiscoveryService){varserviceType= typeDiscoveryService.GetType();if(serviceType.FullName =="Microsoft.VisualStudio.Design.VSTypeResolutionService")// Achieve instantaneous load, vs around a second's freeze{varnormalEntries=(IEnumerable<object>)serviceType.GetField("_normalEntries", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(typeDiscoveryService);// ...
The text was updated successfully, but these errors were encountered:
We should at least change it to warn REFL009. Maybe REFL009 should be default info?
jnm2
changed the title
REFL003 incorrectly assumesthat .GetType() returns only the type seen at compile-time
REFL003 incorrectly assumes that .GetType() returns only the type seen at compile-time
Nov 3, 2018
REFL009 would be fine, but I would probably disable it because it says more about the IDE's metadata settings and the limitations of static analysis than about the types I'm using.
0.1.16-dev
The analyzer should bail if it sees a GetType() on an expression of a virtual type since it can know nothing about the expected concrete type which may be internal to an external lib.
Additionally, if it sees a GetType() on a nonvirtual type, maybe it should bail anyway because it will be reporting #169 in all these cases anyway.
Actual code, in case you wonder why you would do this:
The text was updated successfully, but these errors were encountered: