bkoelman / ResharperCodeContractNullability

Reports diagnostics, helping you to annotate your source tree with (Item)NotNull / (Item)CanBeNull attributes.
https://www.jetbrains.com/resharper/help/Code_Analysis__Code_Annotations.html
Apache License 2.0
26 stars 4 forks source link

Jetbrains.Annotations namespace is duplicated after applying changes #16

Closed imanushin closed 8 years ago

imanushin commented 8 years ago

Steps to reproduce:

  1. Open file with Jetbrains.Annotations namespace declared
  2. Apply code fix for the one of the function arguments
  3. Check the namespaces

Before:

using JetBrains.Annotations;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using CheckContracts;

After:

using JetBrains.Annotations;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using CheckContracts;
using JetBrains.Annotations; //duplicated !!!
bkoelman commented 8 years ago

Thanks for reporting this. However I cannot reproduce with the steps above. It would help if you could attach a sample project.

imanushin commented 8 years ago
  1. Download project
  2. Open file in MSVS
  3. Go to line 18, to argument "PortableSize maxSize"
  4. Press Ctrl-'.'
  5. Select "Add NotNull"
  6. Apply
  7. Check the namespaces

Before:

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using CheckContracts;
using JetBrains.Annotations;

Expected after:

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using CheckContracts;
using JetBrains.Annotations;

Actual after:

using JetBrains.Annotations; // <--- this line was added after the code fix
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using CheckContracts;
using JetBrains.Annotations;
bkoelman commented 8 years ago

@imanushin The related fix in roslyn has been merged. This should light up in the next VS release.