Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Restore requirement for struct constructors to always have formal parameters. #1029
It has been a long standing requirement that C# and VB struct constructors would always have parameters. We have tried to relax this requirements in C#6.0 to make structs more consistent with classes.
While overall parameterless constructors in structs are valid from IL perspective, without a convenient way to declare them they were virtually nonexistent. As we performed more and more testing, we kept discovering cases where parameterless struct constructors caused inconsistent behavior in libraries or even in some versions of CLR.
A good example is the issue reported in the CodePlex bug http://roslyn.codeplex.com/workitem/465 .
After reconsidering the potential issues arising from breaking long standing assumptions, we decided it was best for our users to restore the requirement on struct constructors to always have formal parameters.
Mar 4, 2015
added a commit
Mar 5, 2015
referenced this issue
Mar 5, 2015
I agree with the reasoning for restoring this requirement.