diff --git a/src/ExpressionEvaluator/Core/Source/ResultProvider/Helpers/TypeAndCustomInfo.cs b/src/ExpressionEvaluator/Core/Source/ResultProvider/Helpers/TypeAndCustomInfo.cs index cc007b44e2968..6bcf7427aff38 100644 --- a/src/ExpressionEvaluator/Core/Source/ResultProvider/Helpers/TypeAndCustomInfo.cs +++ b/src/ExpressionEvaluator/Core/Source/ResultProvider/Helpers/TypeAndCustomInfo.cs @@ -21,7 +21,21 @@ public TypeAndCustomInfo(DkmClrType type, DkmClrCustomTypeInfo info = null) public Type Type { - get { return (ClrType == null) ? null : ClrType.GetLmrType(); } + get + { + var t = ClrType?.GetLmrType(); + + //TODO: Sometimes we get byref types here when dealing with ref-returning members. + // That probably should not happen. + // For now we will just unwrap unexpected byrefs + if (t?.IsByRef == true) + { + t = t.GetElementType(); + Debug.Assert(!t.IsByRef, "double byref type?"); + } + + return t; + } } } } diff --git a/src/ExpressionEvaluator/Core/Test/ResultProvider/Debugger/MemberInfo/TypeImpl.cs b/src/ExpressionEvaluator/Core/Test/ResultProvider/Debugger/MemberInfo/TypeImpl.cs index 7318ba0feb288..5ea758efe8f61 100644 --- a/src/ExpressionEvaluator/Core/Test/ResultProvider/Debugger/MemberInfo/TypeImpl.cs +++ b/src/ExpressionEvaluator/Core/Test/ResultProvider/Debugger/MemberInfo/TypeImpl.cs @@ -406,7 +406,7 @@ protected override bool IsArrayImpl() protected override bool IsByRefImpl() { - throw new NotImplementedException(); + return Type.IsByRef; } protected override bool IsCOMObjectImpl()