[c#] C# windows application Event: CLR20r3 on application start

I created a C# application and installed it on my test box. My app works perfect on my dev box, but when I install in on a different machine it crashes in the Main(). I get the EventType: CLR20r3

here is the Event Message

    Problem signature:
    Problem Event Name: CLR20r3
    Problem Signature 01:   logfileviewer.exe
    Problem Signature 02:   1.0.0.0
    Problem Signature 03:   4f356c9c
    Problem Signature 04:   LogFileViewer
    Problem Signature 05:   1.0.0.0
    Problem Signature 06:   4f356c9c
    Problem Signature 07:   94
    Problem Signature 08:   44
    Problem Signature 09:   System.IO.FileNotFoundException
    OS Version: 6.1.7601.2.1.0.256.1
    Locale ID:  1033
    Additional Information 1:   0a9e
    Additional Information 2:   0a9e372d3b4ad19135b953a78882e789
    Additional Information 3:   0a9e
    Additional Information 4:   0a9e372d3b4ad19135b953a78882e789

I used the details and looked up the error code in IL Disassembler and cam back with the following...

    Method #5 (06000094) 
    -------------------------------------------------------
    MethodName: .ctor (06000094)
    Flags : [Public] [HideBySig] [ReuseSlot] [SpecialName] [RTSpecialName] [.ctor] (00001886)
    RVA : 0x000081d0
    ImplFlags : [IL] [Managed] (00000000)
    CallCnvntn: [DEFAULT]
    hasThis 
    ReturnType: Void
    No arguments.

.NET 4.0 has been uninstalled and re installed on the system and did not change anything. I have searched all over the net and everyone with the same problem do not seem to have a solution. I have now spent a day and a half on this problem. I would hate to miss my deadline do to not being able to launch the application.

This is the only code in my Main()

    static void Main()
    {
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        Application.Run(new frmMain());
    }

Here are the details from the Event Viewer

    Application: LogFileViewer.exe
    Framework Version: v4.0.30319
    Description: The process was terminated due to an unhandled exception.
    Exception Info: System.IO.FileNotFoundException
    Stack:
        at LogFileViewer.frmMain.InitializeComponent()
        at LogFileViewer.frmMain..ctor()
        at LogFileViewer.Program.Main()

EventData

    Application: LogFileViewer.exe 
    Framework Version: v4.0.30319 
    Description: The process was terminated due to an unhandled exception. 
    Exception Info: System.IO.FileNotFoundException 
    Stack: at LogFileViewer.frmMain.InitializeComponent() at LogFileViewer.frmMain..ctor() at LogFileViewer.Program.Main() 

Not sure how the designer can have a FileNotFound Exception. I am using the DotNetBar.dll and I am referencing it out of the install directory, so that should be good. I can post my designer if you want, but there is quite a bit there.

This question is related to c# .net file-not-found

The answer is


Have been fighting this all morning and now have it solved and why it happened. Posting with the hope it helps others

I installed the Krypton.Toolkit which added the tools to the Visual studio toolbox automatically. I then added the tools to the designer, which automatically added the dll to the projrect references, however the toolkit was marked as CopyLocal=false

I built an installer, using all dlls in the release build folder (of course the above dll wasn't there).

Setting copylocal=true, then rebuilding the installer, everything worked fine.


To solve CLR20r3 problem set - Local User Policy \ Computer Configuration \ Windows Settings \ Security Settings \ Local Policies \ Security Options - System cryptography: Use FIPS 140 compliant cryptographic algorithms, including encryption, hashing and signing - Disable


.NET has two CLRs 2.0 and 4.0. CLR 2.0 works till .NET framework 3.5. CLR 4.0 works from .NET 4.0 onwards. Its possible that your solution is using a different CLR than your reference assemblies. In your local development environment, you might have both the CLRs and hence you did not faced any problem. However when you moved to deployment environments, they might have a single CLR only and you got this error.


I encountered the same problem when I built an application on a Windows 7 box that had previously been maintained on an XP machine.

The program ran fine when built for Debug, but failed with this error when built for Release. I found the answer on the project's Properties page. Go to the "Build" tab and try changing the Platform Target from "Any CPU" to "x86".


Examples related to c#

How can I convert this one line of ActionScript to C#? Microsoft Advertising SDK doesn't deliverer ads How to use a global array in C#? How to correctly write async method? C# - insert values from file into two arrays Uploading into folder in FTP? Are these methods thread safe? dotnet ef not found in .NET Core 3 HTTP Error 500.30 - ANCM In-Process Start Failure Best way to "push" into C# array

Examples related to .net

You must add a reference to assembly 'netstandard, Version=2.0.0.0 How to use Bootstrap 4 in ASP.NET Core No authenticationScheme was specified, and there was no DefaultChallengeScheme found with default authentification and custom authorization .net Core 2.0 - Package was restored using .NetFramework 4.6.1 instead of target framework .netCore 2.0. The package may not be fully compatible Update .NET web service to use TLS 1.2 EF Core add-migration Build Failed What is the difference between .NET Core and .NET Standard Class Library project types? Visual Studio 2017 - Could not load file or assembly 'System.Runtime, Version=4.1.0.0' or one of its dependencies Nuget connection attempt failed "Unable to load the service index for source" Token based authentication in Web API without any user interface

Examples related to file-not-found

Python FileNotFound Python open() gives FileNotFoundError/IOError: Errno 2 No such file or directory C# windows application Event: CLR20r3 on application start Linux error while loading shared libraries: cannot open shared object file: No such file or directory