Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJérémie Laval <jeremie.laval@gmail.com>2011-01-04 19:58:30 +0300
committerJérémie Laval <jeremie.laval@gmail.com>2011-01-04 20:39:55 +0300
commit84570ffb93ee98d513318c9e7a5e3a111161cf11 (patch)
tree9781d44da26c967fa69c4e484ed57f772203ee70
parent1d44ba22a5fbbf687b993e0aed0c0e1cee7a9d93 (diff)
Use correct exception when a key is not found in ConcurrentDictionary2.8.2
-rw-r--r--mcs/class/corlib/System.Collections.Concurrent/ConcurrentDictionary.cs3
-rw-r--r--mcs/class/corlib/Test/System.Collections.Concurrent/ConcurrentDictionaryTests.cs3
2 files changed, 3 insertions, 3 deletions
diff --git a/mcs/class/corlib/System.Collections.Concurrent/ConcurrentDictionary.cs b/mcs/class/corlib/System.Collections.Concurrent/ConcurrentDictionary.cs
index 6a2e3347ad9..148f14cf9d7 100644
--- a/mcs/class/corlib/System.Collections.Concurrent/ConcurrentDictionary.cs
+++ b/mcs/class/corlib/System.Collections.Concurrent/ConcurrentDictionary.cs
@@ -134,8 +134,7 @@ namespace System.Collections.Concurrent
{
TValue temp;
if (!TryGetValue (key, out temp))
- // TODO: find a correct Exception
- throw new ArgumentException ("Not a valid key for this dictionary", "key");
+ throw new KeyNotFoundException (key.ToString ());
return temp;
}
diff --git a/mcs/class/corlib/Test/System.Collections.Concurrent/ConcurrentDictionaryTests.cs b/mcs/class/corlib/Test/System.Collections.Concurrent/ConcurrentDictionaryTests.cs
index fe0930fec67..e0a52d42162 100644
--- a/mcs/class/corlib/Test/System.Collections.Concurrent/ConcurrentDictionaryTests.cs
+++ b/mcs/class/corlib/Test/System.Collections.Concurrent/ConcurrentDictionaryTests.cs
@@ -26,6 +26,7 @@
using System;
using System.Threading;
using MonoTests.System.Threading.Tasks;
+using System.Collections.Generic;
using System.Collections.Concurrent;
using NUnit;
@@ -146,7 +147,7 @@ namespace MonoTests.System.Collections.Concurrent
Assert.AreEqual(3, map.Count, "#3");
}
- [Test, ExpectedException(typeof(ArgumentException))]
+ [Test, ExpectedException(typeof(KeyNotFoundException))]
public void GetValueUnknownTest()
{
int val;