.NET Framework Developer Center > .NET Development Forums > Common Language Runtime > BC30456: 'InitializeCulture' is not a member of FIXES
Ask a questionAsk a question
 

AnswerBC30456: 'InitializeCulture' is not a member of FIXES

  • Sunday, October 15, 2006 2:25 PMjuicyjuice Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Windows 2003 Server SP1, ASP.Net 2.0

    BC30456: 'InitializeCulture' is not a member of

    Have a bug in your code but throws this error instead of the actual error? Or getting this error randomly? Or a similar error complaining that an asp.net method is not a member of a class like 'Page' when it is!? and mashing refresh a few times sometimes makes it go away...

    After 2 Days of extensive search on the internet and finding plenty of people with this error and very little replies and resolutions, I took upon myself to get to the bottom of this (unacknowledged ASP.net framework bug) and list some steps to help all of you work around it.

    1. If you use Visual studio to publish your site, during the publishing stage on framework 2.0 uncheck the "allow this precompiled site to be updatable".

    2. Ensure ASP.Net is installed correctly, I found that my Web Server root was configured to use ASP.Net 1.1 by default so ran the following line to fix it to 2.0 even though my site was configured for 2.0 at site level, eliminating this glitch seems logical.

    C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis -i

    This will also fix any mapping/installation problems.

    Also ran aspnet_regiis -r

    This will replace all mappings recursively to 2.0 regardless.

    3. Make sure page directives at the top of aspx files are correct and ‘inherits’ is pointing to your class correctly. I could not see any problems with mine, so did not explore down this path to thoroughly, but noted others saying issues with ambiguous inheritance maybe related.

    4. Declare culture in your web.config, example

    <globalization uiCulture="en" culture="en-NZ" />

    OR

    <globalization uiCulture="auto" culture="auto" />

    5. Change debug="true" to "false" in web.config and any pages which have it set (I recommend removing it entirely from pages and just using web.config)

    * This final step eliminated the problem for me, very weird.

    Now if this last step eliminates the problem, and later on down the track you get an error in your codebehind file while coding or debugging, you will no longer be pointed directly to the line in your codebehind file when an exception occurs, asp.net will just show you the line in the aspx file you called from. Temporarily switch debug back to true in web.config if you can't figure out the problem and then you can see it, if InitializeCulture crops back up instead, mash refresh a few times like you used to do! Then turn debug back off.

    ---

    Does anyone else have anymore info?

    My question to Microsoft, why does this behaviour exist? Is it by design or really a bug? If so, why is there no acknowledgment of it as a bug for ASP.Net 2.0?

    -juicyjuice

Answers

  • Wednesday, November 29, 2006 8:27 AMKristoferA - Huagati Systems Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Another cause: remember to clear the application's bin directory on the target server before updating with a new version of your app. Leftovers from a previous VS "publish" is a possible cause of this error.
  • Monday, November 06, 2006 7:21 PMMarion Denny Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Thanks for this post!  I too had a hard time figuring this out... Unfortunately, I tried your steps above and none of them worked.  They did point me to a solution though:

    We were trying to publish our ASPX pages to a mixed site; some DLL's had been compiled in .NET 1.1, and we were moving to 2.0.  All of our pages with code-behind derived from our own custom Page class, and I realized that simply upgrading the site to 2.0 would not force a rebuild of those original DLL's (on top of which all the ASPX pages sat).  My understanding of the page build lifecycle is that the JIT .NET compiler won't rebuild anything unless the files actually change - in this case the ASPX was different, but not the parent class (in our 1.1 DLL's), so while the page was being rebuilt it was attempting to bind to an older compilation of the parent class that did not have the new 2.0 bindings to culture information.

    So, we simply rebuilt the 1.1 DLL's (using VS 2003 - NOT VS 2005 - they are still 1.1) and republished to the bin folder, and then the problem disappeared.

    It makes sense, because the original compilation in 1.1 would have still been there, and obviously none of the new 2.0 stuff - like Culture enhancements - would be there.  Forcing .NET to recompile the base libraries resolved it for us.

  • Thursday, February 08, 2007 7:45 PMbchao Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Your generated aspx files are all using the same CodeFile, yes? From what I'm understanding you can not have multiple aspx files using the same codefile! It seems weird, but this error seems to start occurring when more and more aspx files are using the same codefile.

    Thanks! This is what exactly got me - it took me hours before I see your post. 

    Sometimes I copy and rename a *.aspx and *.aspx.vb before I make some major changes, then go on making the changes with my new copy. I didn't realized in the backup file, it's still pointing to the old Code File. If that's the case, and if you indeed add any new control in the new copy file, then during build it will give this BC 30456 error that XXX is not a member of XXX. And it is true that the new control doesn't exist in the backup *.aspx file. So be careful not to make the same mistake.    

All Replies

  • Monday, October 30, 2006 1:29 PMMendip162 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Dear JuicyJuice,

    Thanks for your post - until I read this I thought I was going crazy.

    Step 5 was the last stage that fixed the problem for me too.  Many thanks!

     

  • Monday, November 06, 2006 7:21 PMMarion Denny Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Thanks for this post!  I too had a hard time figuring this out... Unfortunately, I tried your steps above and none of them worked.  They did point me to a solution though:

    We were trying to publish our ASPX pages to a mixed site; some DLL's had been compiled in .NET 1.1, and we were moving to 2.0.  All of our pages with code-behind derived from our own custom Page class, and I realized that simply upgrading the site to 2.0 would not force a rebuild of those original DLL's (on top of which all the ASPX pages sat).  My understanding of the page build lifecycle is that the JIT .NET compiler won't rebuild anything unless the files actually change - in this case the ASPX was different, but not the parent class (in our 1.1 DLL's), so while the page was being rebuilt it was attempting to bind to an older compilation of the parent class that did not have the new 2.0 bindings to culture information.

    So, we simply rebuilt the 1.1 DLL's (using VS 2003 - NOT VS 2005 - they are still 1.1) and republished to the bin folder, and then the problem disappeared.

    It makes sense, because the original compilation in 1.1 would have still been there, and obviously none of the new 2.0 stuff - like Culture enhancements - would be there.  Forcing .NET to recompile the base libraries resolved it for us.

  • Tuesday, November 07, 2006 12:56 AMJbb1122 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I had this same problem and I narrowed it down to pages that were upgraded from VS 2003.  I deleted the NameSpace that the upgrade wizard created in each file then modified the inherits value.  This seemed to correct the problem.
  • Thursday, November 09, 2006 4:34 AMDawson_Brown Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I've tried all of the above mentioned fixes to this, but it keeps coming back. The frustrating thing is that it is intermittent, i.e., one page will be working, then after a time, it'll not work, but another which didn't work will start working.

    My situation is different slightly to those above, as they all seem slightly different from each other. I have a web app which I've built which has a very simple CMS. When a new page is added in through the CMS, it copies the existing "Pages.aspx" file which just has a couple of web user controls for the content dynamically added to it at run time.

    The File name is stored in the database, as is the content which is rendered in the Web User Controls, then at run time, the page is requested, and it loads the code behind of pages.aspx which gets the apropriate content from the database based on the name of the page being requested, so we have a file which is pages.aspx which has

    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="pages.aspx.vb" Inherits="Pages" MasterPageFile="~/atzmi.master" %>
    <%
    @ Register Src="WUCLeftNav.ascx" TagName="WUCLeftNav" TagPrefix="uc1" %>
    <%
    @ Register Src="WUCMultiRowTemplate.ascx" TagName="WUCMultiRowTemplate" TagPrefix="MRT" %>
    <%
    @ Register Src="WUCStandardTemplate.ascx" TagName="WUCStandardTemplate" TagPrefix="SDT" %>
    <asp:Content runat="server" ID="content1" ContentPlaceHolderID="ContentPlaceHolder1">
    <table border="0" cellpadding="0" cellspacing="0">
    <tr>
    <td valign="top" style="height: 15px">
    <asp:PlaceHolder runat="server" ID="plhLeftNav" EnableTheming="false" />
    </td>
    <td valign="top" style="height: 15px">
    <asp:PlaceHolder runat="server" ID="plhContent" EnableTheming="False" />
    </td>
    </tr>
    </table>
    </
    asp:Content>

    Each ofthe other content pages ends up identical except of course for the file name. This means that a file called "AboutUs.aspx" would have Inherits"Pages" This works fine in the development environment, but after using the Visual Studio Publish function, these pages load sometimes, or sometimes not.

    Could we please have a response to this from Microsoft so that this issue can be put to bed finally. Any response would be better than the silence there seems to be around it.

    Thank you,

     

    Dawson.

  • Thursday, November 09, 2006 2:21 PMjuicyjuice Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi Dawson,

    Since making the above posting, I have discovered more information about number (3) ambiguous inheritance, which is my issue and by the sounds of it yours too. I'm going to be updating my post in the next few days with new information relating to the inheritance system and how pages are compiled under vs 05 and .Net 2.0 vs 1.1

    Your generated aspx files are all using the same CodeFile, yes? From what I'm understanding you can not have multiple aspx files using the same codefile! It seems weird, but this error seems to start occurring when more and more aspx files are using the same codefile.

    Yeh would be nice to get some official help, trust me, I've tried all avenues.
  • Wednesday, November 29, 2006 8:27 AMKristoferA - Huagati Systems Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Another cause: remember to clear the application's bin directory on the target server before updating with a new version of your app. Leftovers from a previous VS "publish" is a possible cause of this error.
  • Thursday, February 08, 2007 7:45 PMbchao Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Your generated aspx files are all using the same CodeFile, yes? From what I'm understanding you can not have multiple aspx files using the same codefile! It seems weird, but this error seems to start occurring when more and more aspx files are using the same codefile.

    Thanks! This is what exactly got me - it took me hours before I see your post. 

    Sometimes I copy and rename a *.aspx and *.aspx.vb before I make some major changes, then go on making the changes with my new copy. I didn't realized in the backup file, it's still pointing to the old Code File. If that's the case, and if you indeed add any new control in the new copy file, then during build it will give this BC 30456 error that XXX is not a member of XXX. And it is true that the new control doesn't exist in the backup *.aspx file. So be careful not to make the same mistake.    

  • Thursday, March 15, 2007 12:03 PMGordopolis Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    yes, clearing the app bin fixed it for me

    :)

  • Tuesday, May 08, 2007 7:54 PMMenashe_u Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Excellent. Step 1 solved the entire problem.
  • Wednesday, June 27, 2007 4:56 PMRobert Blake Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Great Post, did a search for matching Inherits and found it right away.
  • Wednesday, July 11, 2007 7:46 AMdeathbyvegetables Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I was confused, attempted most steps, but what worked for me was removing my code from its initial NameSpace and then refering to the classes by their full name, i.e. namespace.classname.

    hope this helps some people.

     

  • Friday, July 27, 2007 6:47 PMcipher nemo Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thank you so much for taking the time to post this. I was able to find this thread when Googling for the error I received after publishing a blog to my hosting provider.

    Your #4 worked for me. I replaced my globalization line in my web.config file with:

    Code Snippet

    <globalization requestEncoding="utf-8" responseEncoding="utf-8" uiCulture="auto" culture="auto" />


    Thanks again for the help! Smile
  • Thursday, August 23, 2007 3:52 PMKarl Hoaglund Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Thanks so much for your generous contribution!  You're a life saver.

     

    --Karl

     

  • Thursday, September 20, 2007 7:00 PMGregSanders Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Here is another situation in which the 'InitializeCulture' is not a member of... error occurs. This one applies to those of us who write ASPX pages without using the Visual Studio environment. I wanted to include a very short javascript in my ASPX page. So I blithely wrote the following code:

     

    HttpContext.Current.Response.Write("<script language=javascript>") 

    HttpContext.Current.Response.Write(... a few lines of javascript code...)

    HttpContext.Current.Response.Write("</script>")

     

    It threw the error until I re-wrote this as:


    HttpContext.Current.Response.Write(chr(60) & "script language=javascript" & chr(62))

    HttpContext.Current.Response.Write(... a few lines of javascript code...)

    HttpContext.Current.Response.Write(chr(60) & chr(47) & "script" & chr(62))

     

  • Thursday, October 18, 2007 1:36 PMJustDave Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    For me it was due to the fact that I copied and pasted an APS.Net page with a codebehind page.  When I renamed the APSX, it automatically renamed the aspx.vb file.  The problem was that the partial class was duplicated. It worked in the runtime environment, but not once I published it to the Web server.

     

    Once I changed the name of the partial class in the codebehind file, and the corresponding inherits statement in the aspx, It worked fine.

     

  • Thursday, November 15, 2007 12:25 PMThunderdanky Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Another solution.

    step1: Search you pages where the error occured, switch to [source]

    check the 1st line, for example the page name is MyHistory.aspx, the 1st line shoud be like blow:

     <%@ Page Language="VB" AutoEventWireup="false" CodeFile="MyHistory.aspx.vb" Inherits="MyHistory" %>

    step2: Switch to source code page ,in this sample is MyHistory.aspx.vb, check the 1st line , it likes blow

      Partial Class MyHistory

     

    If there is any difference between them, fix it to the right name, I think the problem will be fixed.

     

    Good luck to you.

     

     

  • Monday, December 17, 2007 7:41 PMLuisTorres Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

     

    Thanks a lot!

     

    it worked for me with point 1.

     

     

  • Tuesday, February 19, 2008 8:03 AMAnonymous7692515 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Thank you very much....

    To solve problems, me too...

  • Saturday, March 08, 2008 5:22 PMRodrigo Barçal Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thank you juicyjuice. You helped me to to not have a nervous breakdown. (-:

     

  • Sunday, March 16, 2008 7:30 PMM_o_n_t_y Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Great post, thanks!

     

    In my case, I just had two closing "</FORM>" tags in my aspx page.

  • Monday, March 17, 2008 3:02 AMBeer Will Asahi Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I agree with JustDave. The fix for the InitializeCulture error was making sure the Inherits="xyz" in each aspx was also then shown as the correct Partial Class xyz in the codebehind page; plus making sure all of these Partial Class names were unique throughout the application.

     

    I just don't understand why (a) it works when running/testing in the Devlopment environment, and (b) why it does not show up in the Build errors. (VS 2005). Would have saved me a lot of time.

  • Thursday, March 20, 2008 10:51 PMgchq Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I ran into this after changing the compilation method by using Website Deployment and setting the output assemblies to merge each individual folder output to its own assembly!

     

    I have a few pop up windows (like calendar) that I used to just copy and paste from one directory to another - the copy and paste didn't change the  Partial Class so there were a few versions with the same class name - by editing these on both the aspx page and the page behind to the default Root_Directory_Directory_FileName and once again making the class unique it cured the problem...

  • Tuesday, April 15, 2008 1:28 AMFresan Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
     Mendip162 wrote:

    Dear JuicyJuice,

    Thanks for your post - until I read this I thought I was going crazy.

    Step 5 was the last stage that fixed the problem for me too.  Many thanks!

     

     

    Este error se presenta porque existen dos o mas paginas que estan definidas asi:

    <%@ Page Language="VB" MasterPageFile="~/Principal.master" AutoEventWireup="false" CodeFile="FrmConsulta.aspx.vb" Inherits="FrmConsulta" title="xx" %>

     

    debe revizar que todas apuntes a codebehin asi:

    Partial Class FrmConsulta

    Inherits System.Web.UI.Page

    end class

     

    en mi caso encontre el error porque estaba Inherits="_default", de esta forma llamada frmconsulta lo normal es que apunte al mismo nombre pero estaba apuntando al _default y esta pagina ya existia. Default.aspx

     

    Espero le sea de utilidad

     

  • Thursday, April 24, 2008 1:27 AMapeters89 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
     JustDave wrote:

    For me it was due to the fact that I copied and pasted an APS.Net page with a codebehind page.  When I renamed the APSX, it automatically renamed the aspx.vb file.  The problem was that the partial class was duplicated. It worked in the runtime environment, but not once I published it to the Web server.

     

    Once I changed the name of the partial class in the codebehind file, and the corresponding inherits statement in the aspx, It worked fine.

     



    That's what did it for me
  • Thursday, May 01, 2008 2:08 PMNishant007 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi

    If you use Visual studio to publish your site, during the publishing stage on framework 2.0 uncheck the "allow this precompiled site to be updatable". (This tip was helpful in my context).

    Thanks a lot
    Nishant
  • Tuesday, May 06, 2008 8:10 AMrupurt Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I noticed 2 errors on our production server. The production server runs vbc version 8.0.50727.1433 and my desktop machine runs 8.0.50727.1434. I did not get either of these errors on my desktop machine.

    The 1st problem which caused the InitializeCulture error was that the filenames were lower case and the classnames where Camel style e.g. file was called shopping.aspx instead of Shopping.aspx. So i changed it and it worked without a problem.

    The 2nd problem was that i inherited a class using the full namespace value which the containing class also had. I got the error that it could not find this type. Below is an example that didn't work

    Code Snippet

    Namespace Test.Furniture
    Partial Class Chair
    Inherits Test.Furniture.Seating
    End Class
    End Namespace


    But the following did work

    Code Snippet

    Namespace Test.Furniture
    Partial Class Chair
    Inherits Seating
    End Class
    End Namespace
  • Wednesday, May 07, 2008 5:20 PMjjbuchholz Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I use asp.net 3.5. I had an aspx file by the name of x.aspx and the corresponding codebehind file x.aspx.vb. Additionally I created a new linq2sql class file (y.dbml) that linked to a table called x. Saving the dbml file, automatically created a Partial Public Class x that "sometimes" BC30456-crashed with the Partial Class x in x.aspx.vb. I renamed x.aspx to z.aspx (and adapted the inherits statement and the codebehind file) and my life was worth living again :-)

    buchholz@hs-bremen.de
  • Sunday, July 13, 2008 5:31 PMJumbalaya Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thanks!

    Step one did it immediately!
  • Saturday, July 26, 2008 2:01 PMkpierce0 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Step one did it for me.  Thanks for the help.  
  • Friday, August 22, 2008 7:49 PMFareeth Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thanks

    Step one solved!
    • Edited byFareeth Friday, August 22, 2008 7:52 PMNothing
    •  
  • Thursday, October 23, 2008 2:12 PMBenHuerta Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Step 1 worked for me.
    Ben
  • Friday, December 05, 2008 7:32 PMVanclei Matheus Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I was helped by this post too, thanks juicyjuice!
  • Tuesday, December 23, 2008 6:29 PMp_bhosale Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thanks, removing ver1.1 files from bin folder worked for me.
  • Friday, January 23, 2009 8:28 AMjuicyjuice Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hey guys, thanks everyone for their contributions and making this one of the most popular posts on msdn. Good to see everyone now sorted on this bug which seems to still exist but alas less frequent with later versions of asp.net.

    -JuicyJuice

    Aka: Zarok

    work in I.T in Wellington NZ.. props to the kiwi's out there :)

     

  • Tuesday, January 27, 2009 7:43 AMsolutionSeeker2 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Proposed Answer
    Hi Everybody,

     My situation is a bit different from all of the above. I encounter the same error while debugging. I applied all of the above mentioned solutions with no success at all.

    I have a signin.aspx page for which I have a hyperlink <asp:hyperlink> in the page header. If the link is clicked then the error is generated. While if the same page is accessed from code, all is fine. Earlier the page was working fine but now the same page is issuing the error recursively.

    If anyone knows any other solution please let me know.

    Many thanks in advance for your cooperation.

  • Friday, July 17, 2009 7:36 PMTriptophan Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thank you juicyjuice.  I had ambiguous inheritance and your post ended up saving me a ton of hair pulling.

    I was going mad.  Thank you thank you thank you!
  • Wednesday, September 02, 2009 7:06 AMvsadn Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thanks !! If you use Visual studio to publish your site, during the publishing stage on framework 2.0 uncheck the "allow this precompiled site to be updatable" has solved my problem.It has been observed that "window.open" command using Java script does not function unless we do the above step while publishing.
  • Wednesday, December 09, 2009 5:35 PMGaryAF Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I had the same situation as BCHAO above. I attempted to copy source code from an existing page into a newly created page to get a "jumpstart" instead of creating new page from scratch. When I rebuilt, the original page started failing, saying that my controls "...were not members..." Fortunately, I do all development on a development server so I could go back to my latest production and compare. Turns out that the new "FormName.aspx.designer.vb" -- where FormName is the page I copied the source code from -- file was messed up. it reflected the controls of the newly created form instead of it's original controls. I think it's because when I created the new form, I failed to update the codebehind and references line in the source code so the new form incorrectly referenced the original instead of the new. I corrected the problem by swiping the contents of "FormName.aspx.designer.vb" on the production site and replacing the "FormName.aspx.designer.vb" code on the dev side.


    Retred Air Force