App Crash instantly without exception or log (seems like xamarin/mono bug)

Viewed 5022

It's a weird situation here :) , I have implemented this code in my fragment to scan TCP Ports in multithread environment , it crash when debugging , and sometimes crash in release mode too with thoose messages :

E/art (12972): Nested signal detected - original signal being reported

F/art (12972): art/runtime/fault_handler.cc:117] Check failed: !initialized_

tried to set Target Android to 23 that didn’t work.

tried running adb shell setprop debug.mono.env MONO_DEBUG=soft-breakpoints that didn’t work.

tried to compile using different Android API's Versions

ANY IDEA WHY IS THIS HAPPENING ??

HERE IS MY CODE:

    public void start()
    {
        for (int i = 0; i < 50; i++)
        {
            Task.Run(() => RunScanTcp());
            //ThreadPool.QueueUserWorkItem(RunScanTcp);
            //Thread thread = new Thread(new ThreadStart(RunScanTcp));
            //thread.Start();
        }
    }


    public void RunScanTcp()
    {
        while (abort != true)
        {
                port = port + 1;
                Log.Info("PORT SCANNER", port.ToString());
        }
    }

    public class PortList
    {
        private int start;
        private int stop;
        private int ports;
        private static readonly object _syncRoot = new object();

        public PortList(int starts, int stops)
        {
            start = starts;
            stop = stops;
            ports = start;
        }

        public bool MorePorts()
        {
            lock (_syncRoot)
            {
                return (stop - ports) >= 0;
            }
        }

        public int NextPort()
        {
            lock (_syncRoot)
            {
                if (MorePorts())
                {
                    return ports++;
                }
                return -1;
            }
        }
    }

Im compiling using :

Android Version (Android 7.1 Nougat)

Minimum Android Version :

Android 4.1 (API Level 16 - Jelly Bean)

Target Android Version:

Compile Using SDK Version

UPDATE :

After Visual Studio Update 15.2 (26430.12) , and Xamarin 4.5.0.476 - 30/05/2017(dd/mm/yyyy) the application crashed while is connected to debugger too...

Here is the debugger output :

referenceTable GDEF length=814 1
referenceTable GSUB length=11364 1
referenceTable GPOS length=47302 1
referenceTable head length=54 1
referenceTable GDEF length=428 1
referenceTable GSUB length=2302 1
referenceTable GPOS length=43252 1
referenceTable head length=54 1
referenceTable GDEF length=808 1
referenceTable GSUB length=11364 1
referenceTable GPOS length=49128 1
referenceTable head length=54 1
referenceTable GDEF length=808 1
referenceTable GSUB length=11364 1
referenceTable GPOS length=47320 1
referenceTable head length=54 1
05-31 04:31:51.590 F/art     (17427): art/runtime/fault_handler.cc:117] Check failed: !initialized_ 

Thank's All of you ...

4 Answers
Related