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

static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Exit(); Application.Run(new Form1()); } Why after calling Application.Exit(),
I need to invoke a mapreduce job from java application. I use ToolRunner.run(new Validation(),
Currently I'm checking it in the following way: if (Environment.UserInteractive) Application.Run(new ServiceControllerForm(service)); else ServiceBase.Run(windowsService);
It is really annoying. Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new mainForm()); <-- pausing visual studio breaks here.
I developed one swing application but each time you run application new window is
I wonder how long will an ASP.NET (MVC) application run, when no new requests
When trying to run a new refinerycms application with ruby 1.9.2 rails 3.2.1 and
I need to run/develop a mono-based application on a new dedicated server, and the
I am new to java world. I am trying to run a jms application
when I call Application.Run() on a form, this command halts the program until the

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.