[Mono-bugs] [Bug 535552] New: Decimal.TryParse(string, out decimal) crashes device, ok in simulator

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Aug 31 05:51:09 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=535552


           Summary: Decimal.TryParse(string, out decimal) crashes device,
                    ok in simulator
    Classification: Mono
           Product: MonoTouch
           Version: unspecified
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Class Libraries
        AssignedTo: gnorton at novell.com
        ReportedBy: craig.dunn at conceptdevelopment.net
         QAContact: mono-bugs at lists.ximian.com
          Found By: Beta-Customer


Decimal.TryParse() seems to work fine in the Simulator but causes application
to crash on iPhone 3GS 3.0.1

>From stacktrace (complete trace below):
"Assertion: should not be reached at ../../../../mono/mini/mini-darwin.c:232"

Environment:
iPhone 3GS 3.0.1 32Gb 
MonoTouch b7 (28-Aug-09?)
MonoDevelop IDE 2.1.0 (late-august)
MacOS X Leopard

Code is here http://conceptdevelopment.net/iPhone/BillSplitter01/Main.cs.htm
and http://conceptdevelopment.net/iPhone/BillSplitter01/BillSplitterSoln.zip.
Tested many many different values in the simulator with NO problems. Tested 5
different values on device and crashed every time.

Method follows - the inputs during device testing are set to 'valid' decimal
values (eg. textfieldTotal.Text = "55", textfieldWine.Text=""). If I change
variables "total", "wine" and "foodeach" to int and use int.TryParse() it all
works fine (NO other modifications between the working and crashing versions) 

        private void Calculate()
        {
            decimal total = 0.0m;
            decimal wine = 0.0m;
            int pax = drinkers + nondrinkers;
            labelSplit.Text = "-";
            labelSplit2.Text = "-";
            if (pax > 0)
            {
                string totalText =
textfieldTotal.Text==""?"0":textfieldTotal.Text; 
                string wineText =
textfieldWine.Text==""?"0":textfieldWine.Text;

                if (decimal.TryParse(totalText, out total))  // ### FAILS HERE
I think, but works if i change all the types to int and int.TryParse
                {                    
                    if (decimal.TryParse(wineText, out wine))
                    {
                        decimal foodeach = (total - wine) / pax;
                        if (foodeach > 0)
                        {
                            labelTotal.Text = "$ " + total.ToString("#.00");
                            if (drinkers > 0)
                            {
                                labelSplit.Text = (foodeach +
wine/drinkers).ToString("#.00");
                            }
                            else
                            {  // if no drinkers, add the wine back into the
bill
                                foodeach = (total) / pax;
                            }
                            if (nondrinkers > 0)
                            {
                                labelSplit2.Text = (foodeach).ToString("#.00");
                            }
                        }
                        else Console.WriteLine("cannot be negative " +
foodeach);
                    }
                }    
            }
        }



Stacktrace:

Mon Aug 31 19:16:01 unknown
UIKitApplication:net.conceptdevelopment.billsplitter[0xda28][580] <Notice>:
picker changed2 in 1
Mon Aug 31 19:16:01 unknown
UIKitApplication:net.conceptdevelopment.billsplitter[0xda28][580] <Notice>:
Unregistered icall 'System.Decimal:string2decimal
(System.Decimal&,string,uint,int)'
Mon Aug 31 19:16:01 unknown
UIKitApplication:net.conceptdevelopment.billsplitter[0xda28][580] <Notice>:
Stacktrace:
Mon Aug 31 19:16:01 unknown
UIKitApplication:net.conceptdevelopment.billsplitter[0xda28][580] <Notice>:  
at (wrapper managed-to-native) System.Decimal.string2decimal
(System.Decimal&,string,uint,int) <0x00058>
Mon Aug 31 19:16:01 unknown
UIKitApplication:net.conceptdevelopment.billsplitter[0xda28][580] <Notice>:  
at (wrapper managed-to-native) System.Decimal.string2decimal
(System.Decimal&,string,uint,int) <0xffffffff>
Mon Aug 31 19:16:01 unknown
UIKitApplication:net.conceptdevelopment.billsplitter[0xda28][580] <Notice>:  
at System.Decimal.PerformParse
(string,System.Globalization.NumberStyles,System.IFormatProvider,System.Decimal&,bool)
<0x0052b>
Mon Aug 31 19:16:01 unknown
UIKitApplication:net.conceptdevelopment.billsplitter[0xda28][580] <Notice>:  
at System.Decimal.TryParse (string,System.Decimal&) <0x000b7>
Mon Aug 31 19:16:01 unknown
UIKitApplication:net.conceptdevelopment.billsplitter[0xda28][580] <Notice>:  
at BillSplitter.AppDelegate.Calculate () <0x00283>
Mon Aug 31 19:16:01 unknown
UIKitApplication:net.conceptdevelopment.billsplitter[0xda28][580] <Notice>:  
at BillSplitter.AppDelegate.set_NonDrinkers (int) <0x000bb>
Mon Aug 31 19:16:01 unknown
UIKitApplication:net.conceptdevelopment.billsplitter[0xda28][580] <Notice>:  
at BillSplitter.AppDelegate/PeopleModel.Selected
(MonoTouch.UIKit.UIPickerView,int,int) <0x00133>
Mon Aug 31 19:16:01 unknown
UIKitApplication:net.conceptdevelopment.billsplitter[0xda28][580] <Notice>:  
at (wrapper runtime-invoke) <Module>.runtime_invoke_void__this___object_int_int
(object,intptr,intptr,intptr) <0xffffffff>
Mon Aug 31 19:16:01 unknown
UIKitApplication:net.conceptdevelopment.billsplitter[0xda28][580] <Notice>:  
at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication.UIApplicationMain
(int,string[],intptr,intptr) <0xffffffff>
Mon Aug 31 19:16:01 unknown
UIKitApplication:net.conceptdevelopment.billsplitter[0xda28][580] <Notice>:  
at MonoTouch.UIKit.UIApplication.Main (string[],string,string) <0x000e0>
Mon Aug 31 19:16:01 unknown
UIKitApplication:net.conceptdevelopment.billsplitter[0xda28][580] <Notice>:  
at MonoTouch.UIKit.UIApplication.Main (string[]) <0x00023>
Mon Aug 31 19:16:01 unknown
UIKitApplication:net.conceptdevelopment.billsplitter[0xda28][580] <Notice>:  
at BillSplitter.Application.Main (string[]) <0x0001b>
Mon Aug 31 19:16:01 unknown
UIKitApplication:net.conceptdevelopment.billsplitter[0xda28][580] <Notice>:  
at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object
(object,intptr,intptr,intptr) <0xffffffff>
Mon Aug 31 19:16:01 unknown
UIKitApplication:net.conceptdevelopment.billsplitter[0xda28][580] <Notice>:
Native stacktrace:
Mon Aug 31 19:16:01 unknown
UIKitApplication:net.conceptdevelopment.billsplitter[0xda28][580] <Notice>:    
0   NewWorld                            0x00039768 mono_handle_native_sigsegv +
396
Mon Aug 31 19:16:01 unknown
UIKitApplication:net.conceptdevelopment.billsplitter[0xda28][580] <Notice>:    
1   NewWorld                            0x00056158 sigabrt_signal_handler + 124
Mon Aug 31 19:16:01 unknown
UIKitApplication:net.conceptdevelopment.billsplitter[0xda28][580] <Notice>:    
2   libSystem.B.dylib                   0x31dc260b _sigtramp + 42
Mon Aug 31 19:16:01 unknown
UIKitApplication:net.conceptdevelopment.billsplitter[0xda28][580] <Notice>:    
3   libSystem.B.dylib                   0x31dc4763 kill + 10
Mon Aug 31 19:16:01 unknown
UIKitApplication:net.conceptdevelopment.billsplitter[0xda28][580] <Notice>:    
4   libSystem.B.dylib                   0x31dc4755 raise + 16
Mon Aug 31 19:16:01 unknown
UIKitApplication:net.conceptdevelopment.billsplitter[0xda28][580] <Notice>:    
5   libSystem.B.dylib                   0x31dd94a1 abort + 40
Mon Aug 31 19:16:01 unknown
UIKitApplication:net.conceptdevelopment.billsplitter[0xda28][580] <Notice>:    
6   NewWorld                            0x00190dfc g_logv + 248
Mon Aug 31 19:16:01 unknown
UIKitApplication:net.conceptdevelopment.billsplitter[0xda28][580] <Notice>:    
7   NewWorld                            0x00190e54 g_log + 52
Mon Aug 31 19:16:01 unknown
UIKitApplication:net.conceptdevelopment.billsplitter[0xda28][580] <Notice>:    
8   NewWorld                            0x00007a74 mono_resolve_patch_target +
2312
Mon Aug 31 19:16:01 unknown
UIKitApplication:net.conceptdevelopment.billsplitter[0xda28][580] <Notice>:    
9   NewWorld                            0x00029758 mono_aot_plt_resolve + 392
Mon Aug 31 19:16:01 unknown
UIKitApplication:net.conceptdevelopment.billsplitter[0xda28][580] <Notice>:    
10  NewWorld                            0x0003bbe8 mono_aot_plt_trampoline + 64
Mon Aug 31 19:16:01 unknown
UIKitApplication:net.conceptdevelopment.billsplitter[0xda28][580] <Notice>:    
11  NewWorld                            0x0037de04 generic_trampoline_6 + 116
Mon Aug 31 19:16:01 unknown
UIKitApplication:net.conceptdevelopment.billsplitter[0xda28][580] <Notice>: *
Assertion: should not be reached at ../../../../mono/mini/mini-darwin.c:232

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list