You searched for exceptions
. We found 168
results in 0.094 seconds.
Well you can use ildasm to see what the compiler has optimized for yourself. But if you were expecting it to remove the code entirely, it can't - because those three method calls could throw exceptions or modify state. So the best it could... more
The simplest approach is probably to print the previous line each time: String previousLine = null; String line; while ((line = reader.readLine()) != null) { if (previousLine != null) { System.out.println(previousLine); } ... more
You should absolutely let Java handle this on its own. All you're doing is making your code harder to read and maintain. All the variables you're nulling out are going out of scope at the end of the method anyway - and the GC knows... more
Given the comment thread - this was about not closing all the resources. You're disposing fs (manually, if no exceptions are thrown) but not x. You should really use using statements for everything like this: using (var stream = await... more
The point is that the compiler doesn't know that you're calling an overridden method which doesn't throw any checked exceptions. When it sees: a.process(); it doesn't "know" that the value of a is actually a reference to an instance of... more
As I understand Invoke is launched asynchronously. No, Invoke is synchronous, in that it will block until the delegate has completed in the UI thread. It's unfortunate that this isn't clearly documented in Control.Invoke(Delegate).... more
The error disappears because your code is now valid. (Not nice, but valid.) If a finally block just has a straight return; statement, then the overall try/catch/finally or try/finally statement can't throw any exceptions - so you don't... more
You can't - it might not even be writing to a file, e.g. StringWriter stringWriter = new StringWriter(); PrinterWriter printWriter = new PrintWriter(stringWriter); If you need this information, you could potentially create a subclass of... more
This is the documented behaviour of HtmlContainerControl.InnerHtml - in the "exceptions" section, it's documented that it will throw HttpException if: There is more than one HTML server control. - or - The HTML server control is... more
Not without throwing an exception, no. Bear in mind that in many cases the calling method will be non-void - in that case, what value would you expect it to return? The use case you're describing does sound like it would be better handled... more