WPF: ICommand CanExecuteChanged behaviour change in .NET 4.5 - by Kieron

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 751429 Comments
Status Closed Workarounds
Type Bug Repros 6
Opened 6/28/2012 5:05:19 PM
Access Restriction Public


WPF used to respond to an ICommand.CanExecuteChanged event regardless of what it received in the sender parameter. In .NET 4.5 this behaviour has changed so that the sender parameter must be the bound object. This change has broken one of our class libraries because a separate class can execute the event. 

I have seen that there have been some fixes in .NET 4.5 related to ICommand.CanExecuteChanged and memory leaks so this may be related.
Sign in to post a comment.
Posted by Microsoft on 9/16/2013 at 10:18 AM
Yes, it's included in 4.5.1.
Posted by Gordon999 on 9/16/2013 at 8:28 AM
Will this fix be included in 4.5.1 RC, since window 8.1 has .Net 4.5.1?
Posted by Maximilian Haru Raditya on 1/9/2013 at 7:52 PM
And for Windows 8:


Posted by Maximilian Haru Raditya on 1/9/2013 at 7:25 PM
It seems the fix has just been released:


Posted by Dale B on 1/9/2013 at 2:09 PM
Will the fix go against Windows 8, or against .Net 4.5? Our software targets .Net 4.0, not .Net 4.5, but it only fails on Windows 8.
And is there some way for me to discover when the fix is released?
Posted by Microsoft on 12/14/2012 at 1:38 PM
The fix is currently scheduled for release in Q1 of 2013. That's all I can say for now.
Posted by Dale B on 12/13/2012 at 7:00 AM
It's a LOT of effort for us to work around this bug. Repeating the November 9 question, can you give some timetable when we might see the update that fixes this? Thank you.
Posted by Crwthr on 11/9/2012 at 4:55 AM
Will the fix for this issue be included in the recently announced Windows 8 updates / bug fixes?
Posted by Microsoft on 9/17/2012 at 10:17 AM
A fix for this is on the way. It will be included in a set of compatibility bugfixes (the schedule and format for these are still TBD).

To confirm what many people have observed, this issue arises when the CanExecuteChanged event is raised with the 'sender' parameter set to a value different from the ICommand object of interest (perhaps null, perhaps a different object).
Posted by Peter Verswyvelen on 9/13/2012 at 5:50 AM
It turns out this only happens under very specific conditions; see workaround.
Posted by Peter Verswyvelen on 9/13/2012 at 5:26 AM
I cannot believe that simply installing .NET 4.5 breaks all .NET 4.0 WPF applications that use commands, but helas, our company is also bitten by this bug. Please provide a hotfix or workaround.
Posted by JC at CounterPath on 7/24/2012 at 5:20 PM
I can confirm this is a breaking issue on .NET 4.5 equipped systems running my company's .NET 4.0 targeted software.
Posted by Microsoft on 6/29/2012 at 12:15 AM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Microsoft on 6/28/2012 at 5:50 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)