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

RSRP-469016: Usage of deconstruction extension method breaks many refactorings

$
0
0
Reporter Daniel Schüssler (danlex) Daniel Schüssler (danlex)
Created Apr 1, 2018 11:29:11 PM
Updated Apr 17, 2018 12:42:09 AM
Resolved Apr 2, 2018 10:42:06 AM
Subsystem Psi - C#
Assignee Andrew Karpov (andrew.karpov)
Priority Normal
State Fixed
Type Bug
Fix version 2018.1
Affected versions 2017.3.3, 2017.3.5
Fixed In Version ReSharper 2018.1 EAP 6
VsVersion VS 2017 RTM

Think I finally found the culprit for the silent refactoring failures I've been experiencing (probably explains DEXP-303632 and others, though I'm not certain whether deconstruction extensions were involved there).

Just about any refactoring that involves Class1.Fun in the example below will do nothing (e.g.: 'Extract method' after selecting the body of Fun, inlining Fun into another method, 'Extract superclass' (non-abstract), 'Move class to matching file' after renaming Class1 to Class2, adjusting the namespace to the file location, ...).

    using System.Collections.Generic;

    namespace Example
    {
      public static class KeyValuePairExtensions
      {
        public static void Deconstruct<TK, TV>
          (this KeyValuePair<TK, TV> kvp, out TK key, out TV value)
        {
          key = kvp.Key;
          value = kvp.Value;
        }
      }

      class Class1
      {
        public int Fun(KeyValuePair<int,int> kv)
        {
          var (k, v) = kv;
          return k + v;
        }
      }

    }

Viewing all articles
Browse latest Browse all 106942

Trending Articles



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