C# compiler: strange Compiler Error CS0266 (type1=bool?, type2=bool) - by K G OConnor

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.


0
0
Sign in
to vote
ID 318987 Comments
Status Closed Workarounds
Type Bug Repros 1
Opened 12/20/2007 9:00:07 AM
Access Restriction Public

Description

The compiler reports a Compiler Error CS0266: Cannot implicitly convert type 'bool?' to 'bool'. An explicit conversion exists (are you missing a cast?) when an explicit cast from the result of Convert.ToBoolean is casted to a bool? as a left or right hand side of a comparison, but not for assignment.
Sign in to post a comment.
Posted by Code Grail - Jason on 6/21/2011 at 7:37 PM
I get this when checking IsChecked using v4 of the .NET Framework on a checkbox in a WPF client.
Posted by Microsoft on 1/4/2008 at 1:40 PM
Dear K G OConnor,
Thanks for reporting this odd behavior. Indded it is a bug and it has been fixed in the VS2008 C# compiler as well as the .NET 3.5 framework C# compiler (csc.exe).

We will consider fixing this for a future service pack of the .NET 2.0 framework compiler and VS2005, but it is unlikely this would meet the bar.

Thanks again for the report.

Regards,

Ed Maurer
Development Lead, C# compiler
Posted by Microsoft on 12/20/2007 at 5:01 PM
Thanks for your feedback. We are escalating 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.

Thank you,
Visual Studio Product Team