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

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTijoy Tom Kalathiparambil <tijoytk@microsoft.com>2017-06-27 07:35:38 +0300
committerTijoy Tom Kalathiparambil <tijoytk@microsoft.com>2017-06-27 07:35:38 +0300
commitad9f276a585903147b7962717fcc41fa1279fe45 (patch)
tree3863e36e14143881569b94f6bc23029e513dda7b /src/System.Private.Interop
parent56e3e3f783dab5807b1fd7b3372e20dc37fab3a7 (diff)
Throw right exception if generic argument to EventRegistrationTokenTable is not delegate type
[tfs-changeset: 1663402]
Diffstat (limited to 'src/System.Private.Interop')
-rw-r--r--src/System.Private.Interop/src/Resources/Strings.resx5
-rw-r--r--src/System.Private.Interop/src/System/Runtime/InteropServices/WindowsRuntime/EventRegistrationTokenTable.cs6
2 files changed, 6 insertions, 5 deletions
diff --git a/src/System.Private.Interop/src/Resources/Strings.resx b/src/System.Private.Interop/src/Resources/Strings.resx
index 3af5b510f..a2d51ec82 100644
--- a/src/System.Private.Interop/src/Resources/Strings.resx
+++ b/src/System.Private.Interop/src/Resources/Strings.resx
@@ -363,4 +363,7 @@
<data name="PInvoke_GetProcAddress" xml:space="preserve">
<value>Unable to find an entry point named '{0}' in DLL '{1}'.</value>
</data>
-</root>
+ <data name="TypeNotDelegate" xml:space="preserve">
+ <value>'Type '{0}' is not a delegate type. EventTokenTable may only be used with delegate types.'</value>
+ </data>
+</root> \ No newline at end of file
diff --git a/src/System.Private.Interop/src/System/Runtime/InteropServices/WindowsRuntime/EventRegistrationTokenTable.cs b/src/System.Private.Interop/src/System/Runtime/InteropServices/WindowsRuntime/EventRegistrationTokenTable.cs
index d7515afd9..c5a849362 100644
--- a/src/System.Private.Interop/src/System/Runtime/InteropServices/WindowsRuntime/EventRegistrationTokenTable.cs
+++ b/src/System.Private.Interop/src/System/Runtime/InteropServices/WindowsRuntime/EventRegistrationTokenTable.cs
@@ -24,12 +24,10 @@ namespace System.Runtime.InteropServices.WindowsRuntime
{
// T must be a delegate type, but we cannot constrain on being a delegate. Therefore, we'll do a
// static check at construction time
- /*
if (!typeof(Delegate).IsAssignableFrom(typeof(T)))
- {
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_EventTokenTableRequiresDelegate", typeof(T)));
+ {
+ throw new InvalidOperationException(SR.Format(SR.TypeNotDelegate,typeof(T)));
}
- */
}
// The InvocationList property provides access to a delegate which will invoke every registered event handler