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

RSRP-287887: Invert if + do loop + control flow with `throw`

$
0
0
Reporter Alexander Shvedov (shvedov) Alexander Shvedov (shvedov)
Created Jan 20, 2012 12:04:38 PM
Updated Jan 23, 2012 11:10:18 PM
Resolved Jan 23, 2012 6:59:02 PM
Priority Major
Type Usability Problem
Fix versions Next
State Fixed
Assignee Evgeny Pasynkov (pasynkov)
Subsystem Context actions
Affected versions 6.1, 6.1.1
Fixed in build 6.5.1.3201
using System;

class Program
{
  static void Main()
  {
    var t = typeof(Console);

    Type baseType;
    do
    {
      baseType = t.BaseType;
      if (baseType == null) // <--
      {
        if (t.IsValueType)
        {
          GC.KeepAlive(t);
        }
        else
        {
          throw new ArgumentException("aa");
          // return; <-- fine
        }
      }
    }
    while (baseType == null);
  }
}

after:
using System;

class Program
{
  static void Main()
  {
    var t = typeof(Console);

    Type baseType;
    do
    {
      baseType = t.BaseType;
      if (baseType != null) // <--
      {
      }
      else
      {
        if (t.IsValueType)
        {
          GC.KeepAlive(t);
        }
        else
        {
          throw new ArgumentException("aa");
          // return; <-- fine
        }
      }
    }
    while (baseType == null);
  }
}

Viewing all articles
Browse latest Browse all 106942

Trending Articles



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