Search

The File '' Could Not Be Refactored by aspdotnetdev

Active

5
0
Sign in
to vote
Type: Bug
ID: 550058
Opened: 4/9/2010 4:38:15 PM
Access Restriction: Public
0
Workaround(s)
6
User(s) can reproduce this bug
I already reported this issue on Code Project, so I'll just copy my description from there. However, if you want to see a better formatted version of this description, you can see the original here: http://www.codeproject.com/Questions/70701/Obscure-Error-The-File-Could-Not-Be-Refactored.aspx

Sometimes, I come across a property that, when I try to rename it using the built-in Visual Studio refactoring option, I get a dialog that says:

The file '' could not be refactored. Object reference not set
to an instance of an object.

Do you wish to continue with the refactoring?

[ ] Ignore further refactoring errors
                             [ Yes ] [ No ]

The dialog actually shows empty apostrophes when referring to the file. Google doesn't provide any help. I'm beginning to think this is an obscure Visual Studio bug and that I should report it to Microsoft Connect. Thought I'd see if any of you have come across it before first.

FYI, my solution/projects build fine. The property is not referenced in any XAML. I tried deleting my ".suo" file, my "bin" directory, and my "obj" folder, then rebuilding, but still no dice. I have the latest Microsoft updates. The problem occurs with both Visual C# 2008 Express and Visual Studio 2008 Professional. Though it should not matter, the property looks like this:

private MigrationRequestViewModel Request
{
    get;
    set;
}

I have no problem renaming other properties in the same class in the same file, such as this one:

private MigrationRequestViewModel RequestSnapshot
{
    get;
    set;
}

Any ideas? Note that I realize I could just find all reference to the property and manually rename it, but I'd like to get to the bottom of this error dialog.
Details (expand)

Product Language

English

Version

Visual Studio 2008 SP1

Operating System

Windows XP

Operating System Language

English

Steps to Reproduce

Occurs very rarely, so there is no way to give you steps to reproduce. However, I believe it occurs with the same property in my project reliably. Occurs in both Visual Studio 2008 Professional and Visual C# 2008 Express. I can probably send you my solution if my employer approves of that.

Actual Results

Rather than renaming the property, I get an error dialog instead.

Expected Results

I expect the property to be renamed without an error dialog.
      You can indicate your satisfaction with how Microsoft handled this issue by completing this quick 3 question survey.

 

File Attachments
File Name Submitted By Submitted On File Size  
refactor_rename_error_dialog.png 4/9/2010 10 KB
Sign in to post a comment.
Posted by Microsoft on 6/1/2010 at 11:12 AM
After some investigation, we have located the cause of this issue and have a fix that will be available in an upcoming release.

If you have any questions, please feel free to send mail to Ray Matthieu (ramatthi (at) microsoft (dot) com) or myself joshua(dot)may(at)microsoft(dot)com.
Posted by E. Timothy Uy on 4/28/2010 at 1:38 PM
I use .NET Reactor to secure our code. It appears that this bug is also coupled to a BadImageFormatException after the code is secured. Renaming the method manually does not resolve the issue.
Posted by Microsoft on 4/13/2010 at 1:42 PM
Thanks for your feedback. We're aware of this issue. This issue will not be fixed in any VS2008 patches. Also, this issue also exists in Visual Studio 2010. However, we will strongly consider addressing this issue in a future release.

As a workaround, you may be able to get the refactor to work by first loading any XAML file that exists in your project.

If you have any other questions or issues, feel free to contact me directly. My email is ramatthi (at) microsoft (dot) com.
Posted by Microsoft on 4/11/2010 at 10:24 PM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.

Thank you
Sign in to post a workaround.