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

  • Home
  • SEARCH
  • 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 1019495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:01:18+00:00 2026-05-16T11:01:18+00:00

I have a windows 7 x64 desktop with vs2010 and a virtual box installation

  • 0

I have a windows 7 x64 desktop with vs2010 and a virtual box installation of linux with mono and monodevelop. I compile the following program with vs2010 and run it in the linux virtual machine and it fails with a seemingly uncatchable FileNotFoundException. If I compile it in the virtual machine and run it in windows, it works great.

The problem seems to be that an uncatchable exception is tossed by mono before Main() when it is impossible to load a dll. Is there a way to restructure my program or coerce mono such that I can catch this exception?

I am trying to write a single program that has an interface in either WPF or GTK according to what is available at runtime.

using System;  
#if __MonoCS__  
using Gtk;  
#else  
using System.Windows;  
#endif  
using System.IO;  
using System.Runtime.CompilerServices;  
using System.Collections.Generic;  

namespace Test {

 public static class Program {

  [STAThread]
  public static void Main() {
   try {
    Main2();
   } catch (FileNotFoundException e) {
    Console.WriteLine("Caught FileNotFoundException");
    Console.WriteLine("FileName = {0}", e.FileName);
   }
  }

  [MethodImpl(MethodImplOptions.NoInlining)]
  public static void Main2() {
#if __MonoCS__  
   Application.Init();  
#else  
   Window w = new Window();  
#endif  
  }

 }

}
  • 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-16T11:01:19+00:00Added an answer on May 16, 2026 at 11:01 am

    You are exposing yourself to the implementation details of the JIT-compiler. The exact time it will throw the exception for the missing assembly depends on how eagerly it translates the IL into machine code. I know the Microsoft jitter is truly just-in-time, it compiles one method at a time, just before it is about to execute. Although this is affected by whether or not a debugger is attached. You’re dead in the water if Mono, say, compiles the entire class. The jitter will throw before Main() can start.

    Maybe it will work better if you put Main2() in another class. The best thing to do is just have an assembly available, a dummy if necessary.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Windows C# program that uses a C++ dll for data i/o.
I've just installed Windows 7 x64 Ultimate on my desktop PC. I installed IIS,
I have a Windows 7 x64 machine with Tortoise SVN 32 and 64 bits
I have a Windows 2008 R2 x64 enterprise edition + SQL Server 2008 R2
I have 2 Windows 2008 R2 x64 servers NLB, ARR with shared configuration. I
I am attempting to compile wxWidgets 2.8.11 on Windows 7 x64 for use with
I have IIS 7.5 on Windows 7 x64 and IIS 7.0 on Windows 2008
I'm running Windows Vista x64, and I have JDK 1.6.0_21 (x64 version, I believe)
Can't install or update Evernote 3.5.5 on windows-7-x64. Currently have Evernote 3.5.4 running and
I'm running Google Chrome 8.0.552.215 on Windows 7 x64 Ultimate. I have a simple

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.