JetBrains ReSharper Issue
We have the following C# code where we are populating an imagelist from an image resource file. ReSharper is indicating "Possible "null" assignment to entity with "NotNull" attribute".
The issue would indicate to us that we simply need to check to ensure that our ResMan_Graphics is not null but when we put a check for null in place ... the issue remains.
Here is the code which generates the ReSharper issue;
ResourceManager ResMan_Graphics = new ResourceManager("_Graphics", Assembly.ReflectionOnlyLoad("lib"));
ImageList Icons = new ImageList();
Icons.Images.Add((Image)ResMan_Graphics.GetObject("ICON_Main"));
Has anybody come across this ReSharper comment before and do you have any suggestions on how we can populate an imageList from resource without producing this problem.
NOTE: If we place an imageList component onto a form and then populate the imageList from a resource in code, ReSharper does not produce the comment.