[Mono-bugs] [Bug 54044][Min] Changed - mcs-0.30 compiled exe cannot run under Microsoft .net 1.1

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Mon, 9 Feb 2004 20:34:10 -0500 (EST)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by spouliot@videotron.ca.

http://bugzilla.ximian.com/show_bug.cgi?id=54044

--- shadow/54044	2004-02-09 18:23:09.000000000 -0500
+++ shadow/54044.tmp.5822	2004-02-09 20:34:10.000000000 -0500
@@ -105,6 +105,165 @@
 ------- Additional Comments From liyul@hotmail.com  2004-02-09 18:23 -------
 I sent you the test files as well as detailed conifguration
 information by email. Maybe you can check into bugzilla if need. For
 both Win 2000 and XP, the mcs-0.28 created exe runs without assembly
 binding problem while 0.30 failed. I cannot use .exe.config to make it
 working either.
+
+------- Additional Comments From spouliot@videotron.ca  2004-02-09 20:34 -------
+[received email]
+
+1. I use a slightly different setup from your standard windows 
+distributable
+
+I use an alias exe rather than mcs.bat or such under %windir% to 
+launch the real "mono mcs.exe ..." stuff. Reason for that was due to 
+the fact neither mingw make nor nmake like batch files and 
+xsp/System.Web need to spawn mcs under bin to compile aspx pages. 
+Alternative like using a faked mscoree.dll to launch mono.exe would 
+only work for pre-XP systems due to windows loader change. We also 
+moved all native dll to bin so that there's no chance of wrong dll 
+under %windir%\system32 getting loaded. This way is clean and we 
+don't need system admin's rights to set mono up, --just copy, run a 
+batch file to setup environment and it works.
+
+So my directory layout is
+
+%MONO_BASEPATH% +
+                |-- bin            (all native exe/dll and "alias"
+executables like mcs.exe)
+                |-- lib +          (all assemblies dll/exe)
+                |       |-- locale (do I really need it?)
+                |
+                |
+                |-- etc +
+                        |--mono    (machine.config etc)
+
+In attachment, you can find my batch file to set up environment for 
+mono. I also compiled my mono from CVS branch MONO_0_30/MCS_0_30. I 
+also have source for the alias mcs.exe etc for you. If you also like 
+it, you may forward it to whoever maintains windows build.
+
+2. So I can test different versions without any worry of mixing up 
+with standard windows distributable
+
+a). With mcs-0.28, here it goes
+
+C:\temp\test>mcs timesetter.cs /out:timesetter-mcs-0.28.exe
+Compilation succeeded
+
+C:\temp\test>timesetter-mcs-0.28.exe
+Connecting to http://time.gov/timezone.cgi?UTC/s/0...
+Reading the time...
+Setting current system time to 2/9/2004 9:05:19 PM (UTC).
+
+Unhandled Exception: System.ComponentModel.Win32Exception: A required
+privilege is not held by the client
+   at TimeSetter.SetSystemTime(DateTime dt)
+   at MainModule.Main(String[] args)
+
+C:\temp\test>mono timesetter-mcs-0.28.exe
+Connecting to http://time.gov/timezone.cgi?UTC/s/0...
+Reading the time...
+
+Unhandled Exception: System.FormatException: Invalid format
+in <0x00147> System.DateTime:ParseExact
+(string,string[],System.IFormatProvider,
+System.Globalization.DateTimeStyles)
+in <0x00024> System.DateTime:Parse
+(string,System.IFormatProvider,System.Globali
+zation.DateTimeStyles)
+in <0x0001b> System.DateTime:Parse (string,System.IFormatProvider)
+in <0x00493> .MainModule:Main (string[])
+
+
+C:\temp\test>
+
+The privilege exception with Microsoft .net 1.1 is OK since I am not 
+running as admin. mono 0.28 has regex parsing problem and that's 
+fixed in 0.30. The 0.28 compiled exe actually run under both Win2000 
+and WinXP with Microsoft net runtime 1.1 installed, so windows 
+loader change is not an issue here.
+
+
+b). With mcs-0.30
+
+C:\temp\test>mcs timesetter.cs /out:timesetter-mcs-0.30.exe
+Compilation succeeded
+
+C:\temp\test>timesetter-mcs-0.30.exe
+
+Unhandled Exception: System.IO.FileNotFoundException: File or 
+assembly name System, or one of its dependencies, was not found.
+File name: "System"
+   at MainModule.Main(String[] args)
+
+=== Pre-bind state information ===
+LOG: DisplayName = System, Version=1.0.5000.0, Culture=neutral,
+PublicKeyToken=null
+ (Fully-specified)
+LOG: Appbase = C:\temp\test\
+LOG: Initial PrivatePath = NULL
+Calling assembly : timesetter-mcs-0.30, 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, Version=1.0.5000.0, 
+Culture=neutral,PublicKeyToken=null
+LOG: Attempting download of new URL file:///C:/temp/test/System.DLL.
+LOG: Attempting download of new URL 
+file:///C:/temp/test/System/System.DLL.
+LOG: Attempting download of new URL file:///C:/temp/test/System.EXE.
+LOG: Attempting download of new URL 
+file:///C:/temp/test/System/System.EXE.
+
+
+C:\temp\test>mono timesetter-mcs-0.30.exe
+Connecting to http://time.gov/timezone.cgi?UTC/s/0...
+Reading the time...
+Setting current system time to Monday, 09 February 2004 21:16:15 
+(UTC).
+
+Unhandled Exception: System.ComponentModel.Win32Exception: Some sort 
+of w32error occurred: 0
+in <0x0012a> .TimeSetter:SetSystemTime (System.DateTime)
+in <0x004fa> .MainModule:Main (string[])
+
+
+C:\temp\test>
+
+Microsoft .net runtime cannot bind to System.dll. Mono-0.30 runs it 
+(still fail due to privilege issue, which is fine).
+
+c). With csc in Microsoft .net 1.1
+
+C:\temp\test>csc /target:exe /out:timesetter-ms.exe timesetter.cs
+Microsoft (R) Visual C# .NET Compiler version 7.10.3052.4
+for Microsoft (R) .NET Framework version 1.1.4322
+Copyright (C) Microsoft Corporation 2001-2002. All rights reserved.
+
+
+C:\temp\test>timesetter-ms.exe
+Connecting to http://time.gov/timezone.cgi?UTC/s/0...
+Reading the time...
+Setting current system time to 2/9/2004 11:00:02 PM (UTC).
+
+Unhandled Exception: System.ComponentModel.Win32Exception: A required
+privilege is not held by the client
+   at TimeSetter.SetSystemTime(DateTime dt)
+   at MainModule.Main(String[] args)
+
+
+It runs under mono-0.28/0.30 without System.dll loading error.
+
+3. Attachments: In the test.zip attached, you may find
+
+timesetter.cs
+timesetter-ms.exe
+timesetter-mcs-0.30.exe
+timesetter-mcs-0.28.exe
+mono-d.bat
+alias.cpp
+alias.txt