Bug 28135 - Renaming a custom attribute doesn't preserve custom attribute values.
Summary: Renaming a custom attribute doesn't preserve custom attribute values.
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: C# Binding ()
Version: unspecified
Hardware: PC Mac OS
: Normal normal
Target Milestone: master
Assignee: Mike Krüger
URL:
Depends on:
Blocks:
 
Reported: 2015-03-17 17:14 UTC by Jonathan Pryor
Modified: 2015-05-30 10:48 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Jonathan Pryor 2015-03-17 17:14:32 UTC
Suppose you have a custom attribute:

    [AttributeUsage (AttributeTargets.Method)]
    public class SomethingAttribute : Attribute {
        public SomethingAttribute (string value)
        {
        }
    }

...which is used somewhere:

    class Example {
        [Something ("value")]
        public void Foo ()
        {
        }
    }

Then you decide that SomethingAttribute is a terrible name, and Refactor > Rename the type to "UghAttribute".

After using the IDE's Rename support, the type is properly renamed:

    [AttributeUsage (AttributeTargets.Method)]
    public class UghAttribute : Attribute {
        public UghAttribute (string value)
        {
        }
    }

Unfortunately all custom attribute *use* is "screwed up":

    class Example {
        [UghAttributeUghAttribute]
        public void Foo ()
        {
        }
    }

The original [Something ("value")] becomes [UghAttributeUghAttribute]; the actual parameter values are lost.
Comment 1 Udham Singh 2015-03-18 09:17:07 UTC
I have checked this issue with the help of code provided in bug description and able to reproduce the reported behaviour. Please refer the screencast : http://www.screencast.com/t/rczWBFI7gOj

Ide Log : https://gist.github.com/Udham1/c78030056fe5b698f63f

Environment Info : 

=== Xamarin Studio ===

Version 5.8.1 (build 2)
Installation UUID: ce927b2a-2c07-44c5-b186-09cfdafba6dc
Runtime:
	Mono 3.12.1 ((detached/b63df7d)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 312010002

=== Apple Developer Tools ===

Xcode 6.2 (6776)
Build 6C131e

=== Xamarin.iOS ===

Version: 8.8.1.9 (Business Edition)
Hash: 7e1f69e
Branch: 
Build date: 2015-03-12 15:35:49-0400

=== Build Information ===

Release ID: 508010002
Git revision: 8deb45731afdc20fc720bf293c5aebf796d99363
Build date: 2015-03-13 16:18:33-04
Xamarin addins: 84d611cc17567a68daad719327e90af06d2ae327

=== Operating System ===

Mac OS X 10.9.5
Darwin Xamarin76s-Mac-mini.local 13.4.0 Darwin Kernel Version 13.4.0
    Sun Aug 17 19:50:11 PDT 2014
    root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64
Comment 2 Mike Krüger 2015-05-30 10:48:59 UTC
Works in 6.0