Issue with 'DisconnectedItem' in WPF after Windows 10 update 1803?

时间:2018-07-24 10:00:56

标签: .net wpf windows-10

I have an app deployed to several customers which have suddenly started crashing related to bindings and DisconnectedItem in WPF. This started appearing just after an update of Windows 10 (1803). The problem is I cannot make a new build due to a heavy regulations and a long verification process. Are there any work around or hotfix for this? Any config I can do to by-pass the new unexpected behavior in WPF? Anyone else who have encountered this? The actual error and exception is nothing special and would be easy to fix if I could make a new build, which I can't.

More info:

Apparently the DisconnectedItem is a placeholder object inserted by WPF as DataContext in bindings during some operations like switching DataContext (for some unknown reason). I have worked with WPF for over 10 years and this is the first time I came across this. I don't think it's really part of the public api but an internal thing.

In any case, in my code I expect the DataContext to be of certain type and if not it should crash (wanted behavior). This has as said been working fine and the DataContext was never DisconnectedItem before. But with the same build on Windows 10 1803 I momentarily get DisconnectedItem as DataContext which my app does not handle well (throws exception).

It very much looks to be caused by this update (Feature update 1803) so I suspect others have come across this as well, but perhaps just modified their code to handle it. I don't have that luxury. Bobs not my uncle.

0 个答案:

没有答案
相关问题