Questions tagged [thread-exceptions]

48 questions
42
votes
10 answers

How to throw a checked exception from a java thread?

Hey, I'm writing a network application, in which I read packets of some custom binary format. And I'm starting a background thread to wait for incoming data. The problem is, that the compiler doesn't let me to put any code throwing (checked)…
mik01aj
  • 10,150
  • 11
  • 65
  • 109
15
votes
4 answers

Evaluation requires a thread to run temporarily. Use the Watch window to perform the evaluation

I'm completely stuck. I'm testing MetaTrader API and getting next error when tries to run a method in the Immediate Window of VS 2010: A first chance exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll A first chance…
abatishchev
  • 92,232
  • 78
  • 284
  • 421
9
votes
3 answers

Android : Caused by: android.os.NetworkOnMainThreadException

String response = getResultForRequest(url); Where 'url' is JSON formatted which return bunch of data using http GET method. public static String getResultForRequest(String urlString) throws IOException { URL url = new URL(urlString); …
Dhruv
  • 1,794
  • 3
  • 19
  • 37
7
votes
4 answers

Updating Views asynchronously

I am trying to populate a recyclerview with data from the web which I want to fetch asynchronously. I have a function loadData() which is called onCreateView() which first makes a loading Indicator visible, then calls the suspend function loading…
7
votes
3 answers

Why do AppDomain exceptions invariably terminate the application?

This is related to a previous question. What I'm trying to understand now is how come UI thread exceptions can be prevented from terminating the application while non-UI exceptions can't be. For reference, see this example. Most importantly, what I…
Mike Dinescu
  • 48,812
  • 10
  • 104
  • 136
5
votes
3 answers

'thread._local' object has no attribute

I was trying to change the logging format by adding a context filter. My Format is like this FORMAT = "%(asctime)s %(VAL)s %(message)s" This is the class I use to set the VAL in the format. class TEST: def __init__(self, val): …
DoNNie_DarkO
  • 327
  • 3
  • 4
  • 15
4
votes
4 answers

How do I get the name of the thread that the exception occurred on?

I am handling thread exceptions but I want to get the name of the Thread that the exception occurred on. It appears that when the thread exception fires the event stays on the main thread although I think the exception could have occurred on a…
James
  • 2,586
  • 3
  • 20
  • 32
3
votes
2 answers

Below code runs successfully, so does it mean we can start thread twice?

Below code runs successfully, so does it mean we can start thread twice? public class enu extends Thread { static int count = 0; public void run(){ System.out.println("running count "+count++); } public static void…
Sumit Ganjave
  • 53
  • 1
  • 6
2
votes
1 answer

How to catch async exceptions with the safe-exceptions library?

I'm trying to dive into building concurrent and robust code with Haskell, and it was recommended that I use the safe-exceptions and async libraries. However, I'm having a hard time understanding how to handle non-fatal errors thrown within an async…
2
votes
0 answers

"Not enough space for thread data R6016" Python multiprocessing error showing not enough thread space

I am currently trying to create Hierarchical Clustering using Similarity Matrix on a dataset of 35K images. I am trying to build the similarity matrix by concatenating Gabor filters, zernike moments and HOG of the images. AS the process was slow, I…
2
votes
1 answer

My "MyException" which shows Toast causes trouble while thrown in threads. How should I reorganize Exception handling?

I have written my own Exception (MyException) and implemented Logging and showing Error Messages in Form of Toasts. Here is the shortform of it... public class MyException extends Exception { public MyException(String msg) { …
OneWorld
  • 16,782
  • 18
  • 79
  • 130
2
votes
2 answers

Android control the position of SurfaceView by WindowsManager.LayoutParams

How can I control the position of window? I added the SurfaceView with WindowManager.LayoutParam into the WindowManager; And I tried to change the x and y of WindowManager.LayoutParams in Thread; But I only got the Wrong Thread…
2
votes
1 answer

Using ThreadExceptionEventHandler: determine which thread caused the exception

Using the Application.ThreadExceptionEventHandler, is it possible to determine which thread caused the exception (the thread id)? The same question applies to using the AppDomain.UnhandledExceptionEventHandler to catch non-UI thread exceptions. If…
Mike Dinescu
  • 48,812
  • 10
  • 104
  • 136
1
vote
3 answers

Application.ThreadException on WCF Service?

I can´t find a Application.ThreadException event to listen to on my WCF service. I suppose that this is for WinForms so is there a ThreadException event for WCF services? Or will they end up in AppDomain.CurrentDomain.UnhandledException?
Banshee
  • 15,434
  • 36
  • 111
  • 198
1
vote
0 answers

Not touching the views in doInBackground but still getting this crash logs "android.view.ViewRootImpl$CalledFromWrongThreadException: "

I have gone through all the questions related to this crash android.view.ViewRootImpl$CalledFromWrongThreadException: but all the questions are using views in doInBackground which cause the exception but i am getting the exception that points…
1
2 3 4