I have a page that exhibits the strangest behavior. When creating / debugging my project, I sometimes get build errors that point to my directive on the page.
If I insert extra space between any two attributes in the directive, the error disappears and the assembly succeeds.
Page Directive:
<%@ Page Language="C#" AutoEventWireup="true" EnableSessionState="true" CodeBehind="myPage.aspx.cs" Inherits="com.mycompany.UserControls.myPage" %>
Resulting errors:
Keyword, identifier, or string expected after verbatim specifier: @ C:\mypath\myPage.aspx 1 1 myProjectName A namespace cannot directly contain members such as fields or methods C:\mypath\myPage.aspx 1 1 myProjectName
To repeat, for example, adding extra space between Page and Language="C#" temporarily clears errors. I will see a 100% chance of success in the next build, but the error will appear again. I often get an error by closing the editor that shows myPage.aspx and builds / restores my project.
Note. This behavior was present in Visual Studio 2008 and still remains after the transition to Visual Studio 2010.
Edit: Fixed a typo in which @ was omitted from the given page directive.
Any ideas?
source share