Export (0) Print
Expand All

Refactoring Warning Dialog Box 

This warning dialog box indicates that the compiler does not have a complete understanding of your program, and that it is possible that the refactoring engine might not update all the appropriate references. This warning dialog box also provides an opportunity for you to preview your code in the Preview Changes Dialog Box before you commit changes.

NoteNote

If a method contains a syntax error (which the IDE indicates with a red wavy underline), then the refactoring engine will not update any references to an element within that method. The example below illustrates this behavior.

By default, if you execute a refactoring operation without previewing reference changes and a compilation error is detected in your program, then the development environment displays this warning dialog box.

If you execute a refactoring operation that has Preview reference changes enabled and a compilation error is detected in your program, then the development environment will display the following warning message at the bottom of the Preview Changes dialog box, in lieu of displaying the Refactoring Warning dialog box:

Your project or one of its dependencies does not currently build. References may not be updated.

This refactoring warning is only available for refactoring operations that provide the Preview reference changes option, which is available on the following refactoring dialog boxes:

Show this dialog every time

This option is selected by default. When it is selected, the Refactoring Warning dialog box continues to appear when compilation errors have been detected during a refactoring operation.

Clearing this check box disables this warning dialog box for future refactoring operations. If you clear this check box, then to re-enable this warning dialog box for future refactoring operations, select the Warn if build errors exist when refactoring option in the Advanced, C#/J#, Text Editor, Options Dialog Box.

Continue

Continues the current refactoring operation without a preview of the reference changes.

Preview

Opens the Preview Changes Dialog Box so that you can preview your code.

Cancel

Cancels the current refactoring operation. No changes in your code will occur.

Example

The following code example illustrates where the refactoring engine will not update references. If you use refactoring to rename example to some other name, then the reference in ContainsSyntaxError will not be updated, where as the other two references will be updated.

    public class Class1
    {
        static int example;

        static void ContainsSyntaxError()
        {
            example = 20
        }

        static void ContainsSemanticError()
        {
            example = "Three";
        }

        static void ContainsNoError()
        {
            example = 1;
        }
    }

See Also

Concepts

Refactoring

Community Additions

ADD
Show:
© 2014 Microsoft