AndreyAkinshin / knockout-mvc

Power of Knockout.js for ASP.NET MVC
http://knockoutmvc.com
203 stars 125 forks source link

Setting readonly property #36

Open drvic10k opened 11 years ago

drvic10k commented 11 years ago

In method ConvertData, property.SetValue(data, value, null); tries to set value for a readonly property. This doesn't throw an exception on .NET 4.0, but on .NET 4.5 it does.

The obvious solution is checking if you can wtite to the property: if (property.CanWrite) { property.SetValue(data, value, null); }

This seems to be critical bug, I wonder if anyone else encountered this.