Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7742107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T09:11:57+00:00 2026-06-01T09:11:57+00:00

After installing .NET 4.0, I am now getting an exception on this statement: if

  • 0

After installing .NET 4.0, I am now getting an exception on this statement:

 if (mainForm.versionNumber.Contains("BETA"))  

This is how versionNumber is defined:

public static string versionNumber = "1.1.1 " + compileDate.ToString("dd-MMM-yyyy");

and the run-time errorr is “TypeInitializationException”. What changed from .NET v3.5 to 4.0 that would cause this? And how do I fix it?

UPDATE: here is the exception detail:

> System.TypeInitializationException was unhandled   Message=The type
> initializer for 'Media_Inventory_Manager.mainForm' threw an exception.
> Source=PragerMediaInventoryManager  
> TypeName=Media_Inventory_Manager.mainForm   StackTrace:
>        at Media_Inventory_Manager.Prager.Main() in D:\Prager Software\Media Inventory Manager\Program.cs:line 36
>        at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
>        at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
>        at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
>        at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
>        at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
>        at System.Threading.ThreadHelper.ThreadStart()   InnerException: System.FormatException
>        Message=The string was not recognized as a valid DateTime. There is a unknown word starting at index 0.
>        Source=mscorlib
>        StackTrace:
>             at System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles)
>             at System.DateTime.Parse(String s, IFormatProvider provider)
>             at Media_Inventory_Manager.mainForm..cctor() in D:\Prager Software\Media Inventory Manager\Main Form.cs:line 38
>        InnerException:
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T09:11:58+00:00Added an answer on June 1, 2026 at 9:11 am

    I think it is something wrong with a class initializer fails to initialize a type. It really hard to see what happens when you are not show that much code. If you read on mdsn it says:

    When a class initializer fails to initialize a type, a
    TypeInitializationException is created and passed a reference to the
    exception thrown by the type’s class initializer. The InnerException
    property of TypeInitializationException holds the underlying
    exception.

    TypeInitializationException uses the HRESULT COR_E_TYPEINITIALIZATION,
    that has the value 0x80131534.

    For a list of initial property values for an instance of
    TypeInitializationException, see the TypeInitializationException
    constructors.

    Reference here

    So knowing that i would look at the InnerException and see whats going on.

    EDIT

    With out knowing more about your code. This could be a way to get the InnerException

    try
    {
        mainForm.versionNumber.Contains("BETA");
    }
    catch(TypeInitializationException ex)
    {
        var inner= ex.InnerException;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I get the following exception after installing ASP.NET MVC 4 Beta on a machine
After installing ASP.NET MVC 4 Beta, Visual Studio shows Updating source control status on
I installed my .NET windows service and right after installing I noticed mscorsvw.exe maxing
I installed TestDriven.Net after installing NUnit. When in VS, I run all tests, they
After installing Oracle XE DB and ODP.NET, i tried to run included scripts to
applications which require .NET 2.0 and 3.5 are not running after installing VS 2010
I have verified that after installing the .Net Framework 3.5 SP1, when the User
I am hosting WCF as Windows Service using net.tcp. After installing the windows service
After installing one of my .Net apps on a Windows 7 machine I keep
(this is a .net build server) I'm getting the following error: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(1679,9): error MSB3091:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.