[Mono-bugs] [Bug 81740][Blo] New - Bugs in the use of tailcalls and in the System.Threading.SynchronizationContext.Current

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sat May 26 06:11:11 EDT 2007

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 s.guido at email.it.


--- shadow/81740	2007-05-26 06:11:10.000000000 -0400
+++ shadow/81740.tmp.15300	2007-05-26 06:11:10.000000000 -0400
@@ -0,0 +1,109 @@
+Bug#: 81740
+Product: Mono: Runtime
+Version: 1.2
+OS: All
+OS Details: all; ms Vista/Xp, Linux os
+Status: NEW   
+Priority: Blocker
+Component: misc
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: s.guido at email.it               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+Summary: Bugs in the use of tailcalls and in the System.Threading.SynchronizationContext.Current
+Description of Problem:
+I found the problem when I try to run an assembly writen with
+VisualStudio2005 that use fslib of F# project.
+There are at least a couple of problems : the first is with 
+System.Threading.SynchronizationContext.Current and the second is with
+management of sequence of tail-recursive calls
+That problem can be found alse executing "CuncurrentLife" sample of F#
+distribution (research.microsoft.com/projects/ilx/fsharp.aspx )
+Steps to reproduce the problem:
+1. mono scls_simulator
+2. replace "client.fs" "worker.fs" with the "- x mono.fs" version
+3. recompile
+4. mono scls_simulator
+Actual Results:
+without modifications i got
+Unhandled Exception: System.DivideByZeroException: Division by zero
+  at Client+Client..ctor () [0x00000]
+  at <StartupCode>.Client._main () [0x00000]
+this because mono do not initalise correctly the controls of winform
+If i modify the client.fs and worker.fs to force the initialise of these
+fields (like the "- x mono" version of that 2 file), I got
+System.NullReferenceException: Object reference not set to an instance of
+an obj ect at
+Worker+ctor at 59T[Microsoft.FSharp.Core.FastFunc`2[System.Object,Microsoft.FS
+harp.Core.Unit]].Invoke (Microsoft.FSharp.Core.FastFunc`2 ) [0x00000]
+at Worker+ctor at 76.Invoke (Microsoft.FSharp.Core.Unit _unit) [0x00000]
+at Worker+ctor at 105T[System.String].Invoke (Microsoft.FSharp.Core.FastFunc`2
+, System.String ) [0x00000]
+at Microsoft.FSharp.Core.FastFunc`2[Microsoft.FSharp.Core.FastFunc`2[System.St
+stFunc`2 , Microsoft.FSharp.Core.FastFunc`2 , System.String ) [0x00000]
+at Worker+Worker..ctor (Int32 step_number, Int32 graph_refresh_rate, Int32 dat
+a_refresh_rate, System.String fileName) [0x00000]
+at Client+ctor at 540.Invoke (Microsoft.FSharp.Core.Unit _unit) [0x00000]
+at Client+ctor at 606_2.Invoke (System.EventArgs _arg18) [0x00000]
+at Client+ctor at 606_1.Invoke (System.Object sender, System.EventArgs e)
+at (wrapper delegate-invoke)
+System.MulticastDelegate:invoke_void_object_Event Args
+at System.Windows.Forms.Control.OnClick (System.EventArgs e) [0x00000]
+at System.Windows.Forms.Button.OnClick (System.EventArgs e) [0x00000]
+at System.Windows.Forms.ButtonBase.OnMouseUp
+(System.Windows.Forms.MouseEventArgs mevent) [0x00000]
+at System.Windows.Forms.Button.OnMouseUp
+(System.Windows.Forms.MouseEventArgs e) [0x00000]
+at System.Windows.Forms.Control.WmLButtonUp (System.Windows.Forms.Message&
+at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m)
+at System.Windows.Forms.ButtonBase.WndProc (System.Windows.Forms.Message&
+m) [0x00000]
+at System.Windows.Forms.Button.WndProc (System.Windows.Forms.Message& m)
+at System.Windows.Forms.Control+ControlWindowTarget.OnMessage (System.Windows.
+Forms.Message& m) [0x00000]
+at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Fo
+rms.Message& m) [0x00000]
+at System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg, IntPtr
+wParam, IntPtr lParam) [0x00000]
+This is (according to a reply of Don Syme - the autor of F# language)
+beacuse "tailcalls are not taken correctly. This leads to problems with
+implementing message processing via a sequence of tail-recursive calls"
+like that is in worker.fs
+Expected Results:
+The application runs well with MS .NET Framework 2.0
+(they run fine also without interface with client/worker architetture);
+the problem is located in  System.Threading.SynchronizationContext.Current
+ and in the management of tailcalls
+How often does this happen? 
+Additional Information:
+I think that these bug is very important because they limit the portability
+of F# code, that instead work well without a clinet/worker interface.
+If you want more information do not esitate ti contact me at s.guido at email.it
+Thanks a lot for the attention
+Best regads
+Guido Scatena

More information about the mono-bugs mailing list