Compiler doesnt recognise property in generic if declaration is an interface

There are two workarounds for this issue. Use Tools > Options > Debugging > General. You can tick "Use Managed Compatibility Mode" or "Use the legacy C# and VB.NET expression evaluators".

"Use Managed Compatibility Mode" is unnecessarily cryptic, what it actually does is replace the new debugging engine with the one that was last used in VS2010. The good one. It in effect also gives you the legacy expression evaluator. I recommend you use this one since it also avoids a bunch of other bugs in the new debugging engine. Which got especially buggy in VS2015.

Very few reasons I ever discovered to turn it back off. You miss out on recently added debugger features, I only know of method return value inspection, edit+continue for 64-bit code and the new portable PDB format that is used in .NETCore on non-Windows systems. It must be used to debug C++/CLI code. I don't know what is better about the new expression evaluator, never noticed anything. Pretty easy to live without them, at least for me.

I'm not privy enough to the internals of the debugger team to really tell what is going on. But it doesn't look that good, VS2017 added some new nasty failure modes with the new debugging engine collapsing into a pile of rubble at the worst possible time. Take these options at their face value, they surely exist because they know the latest versions are not up to snuff.


Update: as pointed out by Rand, this particular defect does appear to have been addressed. I'm seeing correct behavior in version 15.9.3.


Bug got fixed in Visual Studio 2019: https://developercommunity.visualstudio.com/content/problem/216341/compiler-doesnt-recognise-property-in-generic-if-d.html

Comment by Ivan Basov [MSFT]:

It seems that the issue is not reproducible in the current Visual Studio. I tried it with VS 2019 Preview 2. The scenario works fine. Thank you for your feedback!

Also tried to reproduce it on my Preview Version 1.1 and it is fixed there aswell.

Gave the latest Version of Visual Studio 2017 (15.9.5) a try aswell and can report it got fixed there aswell.