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 3615664
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T22:24:06+00:00 2026-05-18T22:24:06+00:00

Application.Run(new Main()); This line gives TypeInitializationException was unhandled after I switched from 3.5 to

  • 0
Application.Run(new Main());

This line gives TypeInitializationException was unhandled after I switched from 3.5 to 4 framework.

Why is this?

Edit: Forgot to mention this is a Winforms C# application.

Okay so I have SQLite .NET referenced. I tried this on a project created on .NET 4 by default and didn’t give me any error so I assumed it wasn’t about SQLite .NET
http://sqlite.phxsoftware.com/

Please note v2.0.50727 this is the runtime version of the DLL which seems to be causing the problem.

  • Thrown: “A assemblagem de modo misto foi criada com base na versão ‘v2.0.50727’ do tempo de execução e não é possível carregá-la no tempo de execução 4.0 sem informações de configuração adicionais.” (System.IO.FileLoadException) Exception Message = “A assemblagem de modo misto foi criada com base na versão ‘v2.0.50727’ do tempo de execução e não é possível carregá-la no tempo de execução 4.0 sem informações de configuração adicionais.”, Exception Type = “System.IO.FileLoadException”

Seems he can’t run the DLL on v4 with/ extra configuration.

  • 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-05-18T22:24:07+00:00Added an answer on May 18, 2026 at 10:24 pm

    Look at the InnerException to get the reason that the static constructor of the Main class failed. It is usually caused by static variable initializers throwing an exception.

    Update: my Portuguese is quite rusty, but it looks like you are using an assembly that was written in C++/CLI and built targeting the .NET 2.0 version of the CLR. SqlLite fits that description. Other than getting an update for that assembly, you need to tell the CLR that it is okay to load the assembly with the .NET 4.0 version of the CLR. Project + Add New Item, select Application Configuration File. Make it look like this:

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
      <startup useLegacyV2RuntimeActivationPolicy="true">
        <supportedRuntime version="v4.0"/>
      </startup>
    </configuration>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

It is really annoying. Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new mainForm()); <-- pausing visual studio breaks here.
After our Ruby on Rails application has run for a while, it starts throwing
My .NET application fails when run from a network drive even when the very
This is main program.cs LogError.WriteError(Application started: + DateTime.Now + Environment.NewLine); try { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false);
I am configuring a new environment to run several intranet web applications. I have
My application has no forms. It runs by calling Application.Run();
When the application is run, the DataGridView is bound to a DataTable . Later
How do I force my application to run as 32-bit on a 64-bit machine?
Does anyone know if it's possible to get a Win32 application to run under
How to debug javascript in visual studio when an asp.net application is run under

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.