I usually find .NET error messages very informational, and then I met this one:
Parser Error Message: The file 'src' is not a valid here because it doesn't expose a type.
Say what?
I was seeing this error after compiling and deploying my application. It would run fine for an hour or so, and then tilt -- and badly. The usual means of app domain recycling (IISRESET, change web.config) didn't clear the error; the only way I found to reset the app domain was to the DLL file in \bin. Yikes.
I'll spare you the details of the this error, except to note that it only appeared for pages with user controls. The parser error masks the real issue which you can see when you browse a page without user controls:
Unable to cast object of type 'System.Web.Compilation.BuildResultCompiledAssembly' to type 'System.Web.Util.ITypedWebObjectFactory'.
Cool, a sensible InvalidCastException error (albeit with a scary stack trace deep in the bowels of ASP.NET compilation). Fortunately this one has a KB article with an explanation:
This problem is caused when a satellite assembly that has a nonneutral culture is located directly in the Bin folder of the Web application. Satellite assemblies must be located in a subfolder of the Bin folder. Additionally, satellite assemblies must have a name that is equal to the culture of the assembly, such as en-GB.
I don't have any satellite assemblies in my application, but I did have an assembly-level attribute setting the culture to "en-US". Clearing the attribute cleared the problem.
[assembly: AssemblyCulture("")]
This problem was definitely self-inflicted. I was planning for localization and meant to add the System.Resources.NeutralResourcesLanguageAttribute. I used the AssemblyCulture attribute already in the AssemblyInfo.cs file by mistake. The only unanswered question I have: if setting AssemblyCulture on the application's main DLL breaks the app, why is it in the default AssemblyInfo file?