cezarypiatek / MappingGenerator

:arrows_counterclockwise: "AutoMapper" like, Roslyn based, code fix provider that allows to generate mapping code in design time.
https://marketplace.visualstudio.com/items?itemName=54748ff9-45fc-43c2-8ec5-cf7912bc3b84.mappinggenerator
MIT License
1.03k stars 120 forks source link

Can't get Mapping options in Roslyn menu #50

Closed brrbtr closed 5 years ago

brrbtr commented 5 years ago

I have ReSharper installed, but disabled. Restarted VS 2017. Still no Generate Mapping Code in the Roslyn menu. I verified that the extension appears to be installed. What is required for the Generate Mapping Code to show up ?

cezarypiatek commented 5 years ago

Hi

What exactly version of VS 2017 do you have installed? Did you restart VS after installing the extension? Roslyn menu should be triggered with ctr + . shortcut.

brrbtr commented 5 years ago

VS Enterprise 2017 (15.8.9) Verified that extension is installed. Yes, restarted. Here's what I see: image

cezarypiatek commented 5 years ago

Have you tried with the code that is correct? Your method signature is invalid - no identifier for method parameter.

brrbtr commented 5 years ago

Yes. I had. (I just tried to spin up an example really quickly and forgot to finish...) In the meantime, my system got updated and rebooted for me (without permission, of course). Now, it seems to be working just fine. Sorry for the bother.

cezarypiatek commented 5 years ago

No problem, good to know that even bugs in OS can break Roslyn analyzers.

pug-pelle-p commented 5 years ago

I still experience this problem, is there any known fix for this?

cezarypiatek commented 5 years ago

@pug-pelle-p please update VS 2017 to the newest version and restart your computer

paluch82 commented 5 years ago

Hi, I have Resharper 2018.3.1 and Visual Studio 2017 version 15.9.4. Unfortunately I cannot get the Mapping Generator menu. I tried to restart computer but this didn't help. Do you know how to fix the issue?

cezarypiatek commented 5 years ago

@paluch82 please provide your code where you expect MappingGenerator options.

paluch82 commented 5 years ago

Hi,

Here is my sample code: `public class Test { public class ClassA { public string Name { get; set; } public int Value { get; set; } }

    public class ClassB
    {
        public string Name { get; set; }
        public int Value { get; set; }
    }

    private ClassB Map(ClassA a)
    {

    }
}`

The issue is related with Resharper because when I disable it then MappingGenerator options shows up.

cezarypiatek commented 5 years ago

@paluch82 thank you for reporting this issue. It looks like Resharper 2018.3.1 has different settings in Visual Studio Integration section than before. Please verify your settings (the first option should be unchecked).

image

I'm not sure what is the real culprit: the default settings has been changed or Resharper took over ctr + . shortcut.

paluch82 commented 5 years ago

This resolved the issue. Now it works like a charm. Thanks.

Havret commented 5 years ago

I think this should be included in project's ReadMe.