25

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.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Tyler
  • 1,134
  • 1
  • 10
  • 12
  • 2
    Catch that FileNotFoundException exception and see its details to understand what file is missing. I bet it's DotNetBar.dll – tenorsax Feb 11 '12 at 23:46
  • Yeah, it was DotNetBar. I had to move it to the applications root even though I was referencing it from a folder named "resources". – Tyler Feb 12 '12 at 18:59

5 Answers5

22

I've seen this same problem when my application depended on a referenced assembly that was not present on the deployment machine. I'm not sure what you mean by "referencing DotNetBar out of the install directory" - make sure it's set to CopyLocal=true in your project, or exists at the same full path on both your development and production machine.

Community
  • 1
  • 1
RyanR
  • 7,728
  • 1
  • 25
  • 39
  • Yes, or you can try a tool like smart assembly which allows embedding dependencies in your executable apart from obfuscating it so you would know if it was caused by a missing dll. – Digvijay Feb 12 '12 at 00:00
  • Even though I am referencing the DotNetBar.dll from a resources folder that I created. It seems like I actually have to have the .dll in the root directory where my .exe resides. I have no explanation for this. Maybe someone can enlighten me on the reason. So for others with the same problem. Move whatever .dll's you are referencing to your root folder and see if that resolves your problem. – Tyler Feb 12 '12 at 18:57
  • [This might help](http://msdn.microsoft.com/en-us/library/yx7xezcf(v=vs.71).aspx) – RyanR Feb 12 '12 at 23:43
3

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".

Dale Lutes
  • 31
  • 1
3

.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.

xs2mayank
  • 182
  • 8
  • 1
    To others seeing this: You can try to solve this by updating your referenced assemblies instead of requiring the client to install the older CLR. My coworker was updating a project to 4.5 and having this problem. My first reflex was "did you update your nuget packages?" sure enough.... – Jean-Bernard Pellerin Jan 19 '17 at 16:47
0

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.

Martin
  • 837
  • 1
  • 10
  • 18
-4

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

Nikolay Kostov
  • 16,433
  • 23
  • 85
  • 123
  • For those who considered it an unhelpful answer consider informing why. This same reasoning is seen in other sources: [clr20r3 - resolution](https://hasstoppedworking.com/fix-clr20r3-event-issues/) – Caio de Paula Silva Oct 25 '18 at 17:24