Method <myMethod> can be made private
I tend to trust this advice and quick fix it.
My colleagues tends to get frustrated on my for doing it, since often the method is referred to from XAML.
Is there a good solution for this, except stop trusting R#?
\\Slampen.
Please sign in to leave a comment.
Hi,
you can use the Annotations from R# to annotate those methods with an
"UsedImplicitly" attribute.
Menu Resharper -> Options -> Code Annotations. Hit "Copy default
implementation to clipboard". Then paste the code in any referenced
assembly.
Kind regards,
Henning Krause
I could probarly do that. But going the road where I need to make "hacks" to trust my tool is not helping R#.
Since R# report that the method is not in use and it is, I see this as a bug.
\\
Hello Stian,
How is this method is used in XAML? Which version of ReSharper are you using?
Thank you!
Andrey Serebryansky
Senior Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
The property is on a viewModel that is accessed from XAML using databinding.
I use version 5.1.
Hello Stian,
This problem should be fixed in ReSharper 6.0 which takes such kind of usages
into account. Thank you!
Andrey Serebryansky
Senior Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
Close but no cigar.
When I have properties on my viewModel that I have a two-way databinding too, Resharper tells me that I safely can make the setter private, which is a lie.
Why was not it fixed for properties when you where at it? Almost feel I've been tricked into upgrading from version 5.1.
When will this bug be fixed?
\\Slampen
Hello Stian,
Do I understand correctly that even ReSharper 6 suggests to make methods
private while this will lead to compile errors? Thank you!
Andrey Serebryansky
Senior Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
It generates run time errors.
Compile error would have been a lot better. :)
\\Stian.
Have you set up a design-time data context for your view? When I add the d:DataContext="{d:DesignInstance vm:MyViewModel}" attribute, R# 6.0 gives me intellisense for binding paths, warnings for unknown properties, and recognizes the binding as a usage of the property.
http://karlshifflett.wordpress.com/2009/10/28/ddesigninstance-ddesigndata-in-visual-studio-2010-beta2/