No error indicating that a readonly field is being assigned to where it can't

Thread is closed for posting
2 posts, 0 answers
  1. Andrei
    Andrei avatar
    30 posts
    Member since:
    May 2012

    Posted 05 Jul 2012 Link to this post

    Something like this:

    public class MyClass
        private readonly int _lastId = 0;

        public int GetNextSequentialId()
            return ++_lastId;

    JustCode doesn't find any error here but apparently this class cannot be compiled.

    I understand the impact it may have on performance but I think you have multiple stages in the analysis process so important things get reported fast, and others later. This one can quality for 'others'. You can even run a compiler in the background.. I heard ReSharper does it.
    On the other hand, you analyze each method anyway, for example, when determining unused variables or stuff that can be refactored. It probably wouldn't add much execution time to check what of kind of a field a method tries to use.
  2. Zdravko
    Zdravko avatar
    657 posts

    Posted 09 Jul 2012 Link to this post

    Hi Andrei,

     Thanks for the feedback.
    I reviewed it and added it to our system for fixing.
    Thank you for the help and have a nice day.

    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top