Bug 24577 - Fatal Unhandled Exсeption: System.FormatException
Summary: Fatal Unhandled Exсeption: System.FormatException
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: General (show other bugs)
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Zoltan Varga
URL:
Depends on:
Blocks:
 
Reported: 2014-11-17 08:32 UTC by Dmitry
Modified: 2014-11-21 18:46 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Source vs2012 (49.69 KB, application/octet-stream)
2014-11-17 11:07 UTC, Dmitry
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Dmitry 2014-11-17 08:32:04 UTC
Mono 3.12.1 sgen llvm from git (linux debian 7.6 64bit)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using System.Xml;
using System.Xml.Linq;
using System.Xml.Serialization;

namespace MonoTest
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                var doc = new XDocument();
                doc.Add(new XElement("Root",
                           new XElement("Field1", "sss@sss.com"),
                           new XElement("Field2", "sss")));
                //*******************************************************************************
                // Fatal Unhandled Exception
                //*******************************************************************************
                var test = GetObjectFromXml<CTest>(doc);
            }
            catch(Exception e)
            {
                Console.WriteLine("Error");
            }

            Console.ReadLine();
        }

        public static T GetObjectFromXml<T>(XDocument doc)
        {
            XmlSerializer s = new XmlSerializer(typeof(T));
            var r = doc.CreateReader();
            var o = s.Deserialize(r);

            return (T)o;
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;

namespace MonoTest
{
    [XmlRoot("Root")]
    public class CTest
    {
        public long Field1;
        public string Field2;
    }
}
Comment 1 Dmitry 2014-11-17 11:07:46 UTC
Created attachment 8768 [details]
Source vs2012
Comment 2 Zoltan Varga 2014-11-17 17:16:00 UTC
What is the problem here, and what is the expected behaviour ?
Comment 3 Dmitry 2014-11-17 21:03:42 UTC
crash mono, not execute catch block
Comment 4 Dmitry 2014-11-17 21:08:19 UTC
if 'Field1' is 'int' type to not crash
Comment 5 Zoltan Varga 2014-11-18 01:25:12 UTC
What is the output of mono --version ?
Comment 6 Dmitry 2014-11-18 03:23:53 UTC
Mono JIT compiler version 3.12.1 (master/4f237e0 Mon Nov 17 17:08:15 MSK 2014)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       altstack
        Notifications: epoll
        Architecture:  amd64
        Disabled:      none
        Misc:          softdebug
        LLVM:          yes(3.6.0svn-mono-master/5486eb2)
        GC:            sgen
Comment 7 Dmitry 2014-11-18 03:32:22 UTC
run MonoTest


root@1945war:/home/Project1945/MonoTest# mono MonoTest.exe

Unhandled Exception:
System.FormatException: Input string was not in the correct format
  at System.Int64.Parse (System.String s, NumberStyles style, IFormatProvider provider) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.FormatException: Input string was not in the correct format
  at System.Int64.Parse (System.String s, NumberStyles style, IFormatProvider provider) [0x00000] in <filename unknown>:0
root@1945war:/home/Project1945/MonoTest#
Comment 8 Zoltan Varga 2014-11-18 03:38:23 UTC
Could you try with the latest version of our LLVM repo (master branch, 0e362dce134e2234abb28465f05f0564f43b1dfb) ?
Comment 9 Dmitry 2014-11-18 05:18:43 UTC
install mono from https://github.com/mono/llvm.git not effect

Mono JIT compiler version 3.12.1 (master/4f237e0 Tue Nov 18 13:57:54 MSK 2014)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       altstack
        Notifications: epoll
        Architecture:  amd64
        Disabled:      none
        Misc:          softdebug
        LLVM:          yes(3.6.0svn-mono-mono/5486eb2)
        GC:            sgen


mono MonoTest.exe and mono MonoTest.exe --nollvm MonoTest.exe generates exception

Unhandled Exception:
System.FormatException: Input string was not in the correct format
  at System.Int64.Parse (System.String s, NumberStyles style, IFormatProvider provider) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.FormatException: Input string was not in the correct format
  at System.Int64.Parse (System.String s, NumberStyles style, IFormatProvider provider) [0x00000] in <filename unknown>:0
Comment 10 Zoltan Varga 2014-11-18 16:30:51 UTC
Could you try running with -O=-aot ?
Comment 11 Zoltan Varga 2014-11-18 16:53:48 UTC
Fixed in mono master 672a02e1779f2c37edee7bf6f8ecb58f888f3cc5.
Comment 12 Dmitry 2014-11-21 03:17:20 UTC
Again error

Mono JIT compiler version 3.12.1 (master/1230a40 Fri Nov 21 11:46:30 MSK 2014)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       altstack
        Notifications: epoll
        Architecture:  amd64
        Disabled:      none
        Misc:          softdebug
        LLVM:          yes(3.6.0svn-mono-mono/5486eb2)
        GC:            sgen


Unhandled Exception:
System.FormatException: Input string was not in the correct format
  at System.Int64.Parse (System.String s, NumberStyles style, IFormatProvider provider) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.FormatException: Input string was not in the correct format
  at System.Int64.Parse (System.String s, NumberStyles style, IFormatProvider provider) [0x00000] in <filename unknown>:0
root@1945war:/home/Project1945/MonoTest#
Comment 13 Zoltan Varga 2014-11-21 03:41:52 UTC
Use -O=-aot as a workaround until this is fixed.
Comment 14 Zoltan Varga 2014-11-21 18:46:54 UTC
Should be fixed now.