You searched for exceptions
. We found 168
results in 0.136 seconds.
To my mind, you should always override GetHashCode if you override Equals - otherwise you're violating the contracts of those methods. However, for mutable types, client code needs to be aware that if it does mutate a value used as a key... more
Even though the anonymous types are accessible in your test project, that doesn't mean they'll be used when you write new { ... }. If you look at actionResult.Value.GetType() and expectedActionResult.Value.GetType() I strongly suspect... more
You're returning response immediately - even though the callback which assigns a useful value to response will only fire later. Do you understand how BeginGetResponse works? It would be worth studying the documentation and examples... more
In the second code, you're synchronously waiting for the continuation to complete. In the first version, the method will return to the caller as soon as it hits the first await expression which isn't already completed. They're very... more
I can think of two simple reasons this might be happening: You have something else which is already listening on port 80 (such as IIS) You don't have permission to listen on port 80 The exception should indicate which of these is the... more
I've searched around and I want to abort a thread and restart it, something who should be really simple but no one is answering. You can't - it's as simple as that. Once a thread has been successfully aborted (i.e. it really has... more
The simplest approach would probably be to use LINQ combined with File.ReadLines: string line = File.ReadLines("foo.txt").ElementAt(6); // 0-based You could use File.ReadAllLines instead, but that would read the whole file even if you... more
The trouble is that you're trying to deserialize an object when you've already read all the data from it just beforehand: readStream = new StreamReader(receiveStream); Console.WriteLine (readStream.ReadToEnd()); After those line, the... more
I think this is a subtlety of the unbox and unbox.any IL instructions. From ECMA 335, section III.4.32 (unbox operation - unbox.any is similar) Exceptions: System.InvalidCastException is thrown if obj is not a boxed value type,... more
You're calling File.Create at the start of the method - which is returning you a stream, which stays open. It's not clear why you're calling that at all, but I'd suggest just removing that line. You should also use a using statement, only... more