Bugzilla – Bug 312355
Program compiled against System.Windows.Forms fails to execute under Windows XP
Last modified: 2007-09-15 21:24:23 UTC
---- Reported by 4lw0e0402@sneakemail.com 2003-05-19 06:05:06 MST ---- ####################### Description of Problem: ####################### A simple test application was made using System.Windows.Forms. The following is its source code: ---8<--- using System; using System.Drawing; using System.Windows.Forms; class Test : Form { Test() { Button test = new Button(); test.Text = "click me"; test.Size = new Size(100, 25); test.Location = new Point(15, 20); Controls.Add(test); } static void Main() { Application.Run(new Test()); } } ---8<--- This program was compiled first with CSC and runs fine under Windows. However, when the program is compiled with MCS, it does not run under Windows. The file is compiled with the following command-line: mcs -r:System.Windows.Forms.dll -r:System.Drawing.dll Test.cs ..and it compiles succesfully, but generates the following error when run under Windows with the .NET runtime: ---8<--- Unhandled Exception: System.IO.FileNotFoundException: File or assembly name Syst em.Windows.Forms, or one of its dependencies, was not found. File name: "System.Windows.Forms" Fusion log follows: === Pre-bind state information === LOG: DisplayName = System.Windows.Forms, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null (Fully-specified) LOG: Appbase = X:\ LOG: Initial PrivatePath = NULL Calling assembly : Test, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null. === LOG: Application configuration file does not exist. LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind). LOG: Post-policy reference: System.Windows.Forms, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null LOG: Attempting download of new URL file:///X:/System.Windows.Forms.DLL. LOG: Attempting download of new URL file:///X:/System.Windows.Forms/System.Windows.Forms.DLL. LOG: Attempting download of new URL file:///X:/System.Windows.Forms.EXE. LOG: Attempting download of new URL file:///X:/System.Windows.Forms/System.Windows.Forms.EXE. ---8<--- ############################### Steps to reproduce the problem: ############################### 1. Compile the source code above with the Mono C# compiler MCS. 2. Attempt to execute the resulting EXE file on a Windows machine with the .NET runtime. I tested Windows XP with .NET 1.0 and .NET 1.1, and Windows 2000 with only .NET 1.0 and got the same results. ####################### Additional Information: ####################### If the binary is placed into the directory containing System.Windows.Forms.dll (on my system, X:\Windows\Microsoft.NET\Framework\v1.0.3705\), then it generates a different error: Unhandled Exception: System.IO.FileLoadException: The located assembly's manifest definition with name 'System.Windows.Forms' does not match the assembly reference. File name: "System.Windows.Forms" Fusion log follows: === Pre-bind state information === LOG: DisplayName = System.Windows.Forms, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null (Fully-specified) LOG: Appbase = X:\WINDOWS\MICROSOFT.NET\FRAMEWORK\V1.0.3705\ LOG: Initial PrivatePath = NULL Calling assembly : Test, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null. === LOG: Application configuration file does not exist. LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind). LOG: Post-policy reference: System.Windows.Forms, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null LOG: Attempting download of new URL file:///X:/WINDOWS/MICROSOFT.NET/FRAMEWORK/V1.0.3705/System.Windows.Forms.D LL. WRN: Comparing the assembly name resulted in the mismatch: PUBLIC KEY TOKEN ---- Additional Comments From miguel@ximian.com 2003-05-21 19:39:08 MST ---- Fixed on CVS. But keep in mind that Windows.Forms is not yet supported by Mono. Unknown bug field "cf_op_sys_details" encountered while moving bug <cf_op_sys_details>Compile on RedHat 8.0, attempt to run on Windows XP w/ .NET 1.0 and 1.1</cf_op_sys_details> Unknown operating system unknown. Setting to default OS "Other". Skipping unknown keyword: portability.