Bug 56770 - App Crash instantly without exception or log
Summary: App Crash instantly without exception or log
Status: RESOLVED DUPLICATE of bug 56765
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2017-05-23 17:49 UTC by Emin Kokalari
Modified: 2017-06-05 18:32 UTC (History)
3 users (show)

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

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 Developer Community or GitHub 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 DUPLICATE of bug 56765

Description Emin Kokalari 2017-05-23 17:49:12 UTC
It's a weird situation here :) , i have implemented this code in my fragment to scan TCP Ports in multithread enviroment , everything is working fine when the phone is connected in visual studio debbuger , but when i test the app outside debugger in release or debug configuration it crash without throwing any exception or any log in logcat except this line(that i dont know if it has any meaning for this problem) :

[art] art/runtime/fault_handler.cc:117] Check failed: !initialized_

OR

art Nested Signal Detected - original signal being reported

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

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

ANY IDEA WHY IS THIS HAPPENING ??

HERE IS MY CODE :
public void start(int threadCounter)
    {
        Task.Run(() =>
        {
            for (int i = 0; i < threadCounter; i++)
            {
                Task.Factory.StartNew(RunScanTcpAsync);
                //Thread.Sleep(150);
                //Thread thread1 = new Thread(new ThreadStart(RunScanTcpAsync));
                //thread1.Start();
            }
        });
    }
    public async Task RunScanTcpAsync()
    {
        int port = new int();
        while ((port = portList.NextPort()) != -1 && nderprit != true)
        {
            count = tcp_count = port;
            TcpClient tcpClient = new TcpClient();
            var mre = new ManualResetEvent(false);
            try
            {
                Task<TcpClient> connectionTask = tcpClient.ConnectAsync(host, port).ContinueWith(task =>
                {
                    if (task.IsFaulted)
                    {
                        return null;
                    }
                    else
                    {
                        return tcpClient;
                    }
                }, TaskContinuationOptions.ExecuteSynchronously);
                var timeoutTask = Task.Delay(tcpTimeout).ContinueWith<TcpClient>(task => null, TaskContinuationOptions.ExecuteSynchronously);
                var resultTask = Task.WhenAny(connectionTask, timeoutTask).Unwrap();
                //resultTask.Wait();
                //var resultTcpClient = resultTask.Result;
                // Or shorter by using `await`:
                var resultTcpClient = await resultTask;

                if (resultTcpClient != null)
                {
                    Activity.RunOnUiThread(() =>
                    {
                        received_tcp++;
                        mdata.Add(new data() { titulli = "Port : " + port, sekuenca = "Sequence : ", ttl = "Connection Sucessfull !", madhesia = "", koha = "Time : " });
                        mAdapter.NotifyItemInserted(mdata.Count() - 1);
                        if (ndaluar == false)
                        {
                            mRecyclerView.ScrollToPosition(mdata.Count() - 1);
                        }
                        mre.Set();
                    });
                    mre.WaitOne();
                    tcpClient.Dispose();
                    tcpClient.Close();
                    tcpClient = null;
                }
                else
                {
                    tcpClient.Dispose();
                    tcpClient.Close();
                    tcpClient = null;
                }

            }
            catch (Exception)
            {
                tcpClient.Dispose();
                tcpClient.Close();
                tcpClient = null;
            }

            mre.Dispose();
        }
}
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

NOTE :

The code is working very fine without any error or crash when the phone that im testing the app is debugging , it happen when i open the app in release configuration or when it is not connected in debugger
Comment 1 Brendan Zagaeski (Xamarin Team, assistant) 2017-06-05 18:32:03 UTC

*** This bug has been marked as a duplicate of bug 56765 ***