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:
authorLuqun Lou <luqunl@microsoft.com>2017-06-19 07:58:50 +0300
committerLuqun Lou <luqunl@microsoft.com>2017-06-19 07:58:50 +0300
commit0dbbd725a5693fe594e8bfdcaf8bf0b4a468d198 (patch)
tree45ce9cbe9d7c729c1753859bde327a555fac073e /src/System.Private.Interop
parent9de4cb5a06f58b70a29ecfb5ee2a8c18824b6b6a (diff)
Fix For Bug296322
Bug 296322 # [AppCompat] System.Reflection.AmbiguousMatchException:Ambiguous match found.. The issue is related to Jupiter data binding for hiding property with different return type, see following sample code. public class A { public int P {get;set;} } public class B : A { public new string P {get;set;} } <TextBlock name="myTextBlock" Text="{Binding P}" /> myTextBlock.DataContext = new B{ P = "B"}; Behavior: Desktop: it will throw AmbiguousMatchException first, and then swallow it, return null and S_OK NS2.0-: it will return B.P NS2.0+: it will throw AmbiguousMatchException due to Reflection Change The change is to align Desktop behavior--swallow the exception and return null property and S_OK [tfs-changeset: 1662099]
Diffstat (limited to 'src/System.Private.Interop')
-rw-r--r--src/System.Private.Interop/src/Shared/StandardInterfaces.cs29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/System.Private.Interop/src/Shared/StandardInterfaces.cs b/src/System.Private.Interop/src/Shared/StandardInterfaces.cs
index e623091d6..b480e37d3 100644
--- a/src/System.Private.Interop/src/Shared/StandardInterfaces.cs
+++ b/src/System.Private.Interop/src/Shared/StandardInterfaces.cs
@@ -545,21 +545,22 @@ namespace System.Runtime.InteropServices
HSTRING unsafe_name,
IntPtr __IntPtr__unsafe_customProperty)
{
-
void** unsafe_customProperty = (void**)__IntPtr__unsafe_customProperty;
+ // Initialize [out] parameters
+ *unsafe_customProperty = default(void*);
object target = ComCallableObject.FromThisPointer(pComThis).TargetObject;
string propertyName = McgMarshal.HStringToString(unsafe_name);
try
{
global::Windows.UI.Xaml.Data.ICustomProperty property = ManagedGetCustomProperty(target, propertyName);
- *unsafe_customProperty = (void*)McgComHelpers.ManagedObjectToComInterface(
- property,
- typeof(global::Windows.UI.Xaml.Data.ICustomProperty).TypeHandle);
+ *unsafe_customProperty = (void*)McgComHelpers.ManagedObjectToComInterface(
+ property,
+ typeof(global::Windows.UI.Xaml.Data.ICustomProperty).TypeHandle);
}
- catch (Exception ex)
+ catch (Exception)
{
- return McgMarshal.GetHRForExceptionWinRT(ex);
+ // Don't fail if property can't be found
}
return Interop.COM.S_OK;
}
@@ -608,9 +609,10 @@ namespace System.Runtime.InteropServices
TypeName unsafe_type,
IntPtr __IntPtr__unsafe_customProperty)
{
- //__com_Windows_UI_Xaml_Data__ICustomProperty** unsafe_customProperty = (__com_Windows_UI_Xaml_Data__ICustomProperty**)__IntPtr__unsafe_customProperty;
void** unsafe_customProperty = (void**)__IntPtr__unsafe_customProperty;
-
+
+ // Initialize [out] parameters
+ *unsafe_customProperty = default(void*);
try
{
object target = ComCallableObject.FromThisPointer(pComThis).TargetObject;
@@ -622,9 +624,9 @@ namespace System.Runtime.InteropServices
property,
typeof(global::Windows.UI.Xaml.Data.ICustomProperty).TypeHandle);
}
- catch (Exception ex)
+ catch (Exception)
{
- return McgMarshal.GetHRForExceptionWinRT(ex);
+ // Don't fail if property can't be found - just return S_OK and NULL property
}
return Interop.COM.S_OK;
@@ -712,7 +714,6 @@ namespace System.Runtime.InteropServices
return null;
}
-
[NativeCallable]
static int GetStringRepresentation__STUB(
System.IntPtr pComThis,
@@ -768,7 +769,7 @@ namespace System.Runtime.InteropServices
{
TypeName* unsafe_value = (TypeName*)__IntPtr__unsafe_value;
-
+ *unsafe_value = default(TypeName);
int kind;
try
{
@@ -784,9 +785,9 @@ namespace System.Runtime.InteropServices
unsafe_value->Kind = (TypeKind)kind;
}
- catch (Exception ex)
+ catch (Exception)
{
- return McgMarshal.GetHRForExceptionWinRT(ex);
+ // Don't fail---Align with desktop behavior
}
return Interop.COM.S_OK;
}