Field is never assigned - Resharper 6.1


How do i configure Resharper to recognize filed that assign in run time by using reflection:
i am using WebDriver framework with the following code:

public class VideoInfo
        [FindsBy(How = How.ClassName, Using = "detailsTitle")]
        private IWebElement _videoInfoDetailsTitle; //here i got the warning msg: 'Field is never assigned'

        public VideoInfo(IWebDriver webDriver) : base(webDriver)
            PageFactory.InitElements(WebDriver, this); //this functino assign _videoInfoDetailsTitle

10x a lot!
1 comment
Comment actions Permalink

Hello Itay
     You can mark such fields with the 'UsedImplicitly' attribute. To get source code for this attributes open ReSharper | Options | Code Inspection | Code Annotations, click 'Copy to clipboard' and paste the code somewhere in your solution. Thank you!

Andrey Serebryansky

Senior Support Engineer

JetBrains, Inc

"Develop with pleasure!"


Please sign in to leave a comment.