Quantcast
Channel: YouTrackReSharper (RSRP) - Bug and Issue Tracker
Viewing all articles
Browse latest Browse all 106942

RSRP-215047: Wrong "Unreachable Code" warning

$
0
0
Reporter Alex Berezoutsky (fergard) Alex Berezoutsky (fergard)
Created Feb 15, 2011 5:08:18 PM
Updated Jan 18, 2012 1:52:07 PM
Resolved Jan 18, 2012 1:52:07 PM
Priority Major
Type Bug
Fix versions 6.1
State Fixed
Assignee Evgeny Pasynkov (pasynkov)
Subsystem No subsystem
Affected versions 5.1.2
Fixed in build No Fixed in build
        private class A
        {
            private readonly B _b;
            public A(B b)
            {
                _b = b;
            }
            public void Change()
            {
                _b.Number++;
                _b.Magic = null;
            }
        }

        private class B
        {            
            public bool? Magic { get; set; }
            public int Number { get; set; }
        }

        [TestMethod]
        public void Ania()
        {
            B b = new B {Number = 10, Magic =true};
            A a= new A(b);

            
            if (b.Number != 10 || b.Magic!=true)
            {
                throw new Exception("Select all");
            }
            a.Change();
            if (b.Number!=11 || b.Magic!=null)
            {
                throw new Exception("Select all");  
            }   
   
            //This line is unreachable
            a.Change();
        }

Viewing all articles
Browse latest Browse all 106942

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>