I've notice a change of behavior from Resharper 4.0 to 4.1. When using the CodeFile keyword (instead of CodeBehind) in the @Page declaration of an aspx or ascx file, Resharper 4.1 is not aware of the .cs file that backs the web form. It places auto-generated code into <script> tags in the form, instead of into the code file. It also "cannot resolve symbol" for methods coded in the .cs file, but referenced from the form.
At runtime, everything works fine, despite Resharper's objections. This was not a problem in Resharper 4.0.
Steps to reproduce:
1) Create a new WebForm aspx page.
2) Change the @Page declaration from CodeBehind to CodeFile, so it looks like this:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="WebForm1.aspx.cs" Inherits="MyProject.WebForm1" %>
3) Place a button on the page, add an OnClick method:
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
4) Have Resharper "Create method Button1_Click". Notice that the newly generated code is placed in the web form, rather than in the code file.
5) Move the newly generated code the to code file. Notice that Resharper now reports it "Cannot reolve symbol Button1_Click" from the web form.
To reiterate, this code works fine at runtime despite Resharper's objections; and this was not a problem until I upgraded from Resharper 4.0 to 4.1.
Can anyone confirm this? Should I submit this as a bug?