Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Commented Issue: Model-binding collection fails when non-collection property shares a prefix [832]

$
0
0
Given a collection property named "foos" and another property named "foosBar" on an object being model-bound, because of the implementation of the PrefixContainer (specifically the IsPrefixMatch method), if "foosBar" is on a boundary checked by Array.BinarySearch, the algorithm will miss all the collection properties, and the collection will be null after model-binding completes.

I've included failing test in pull request [4032](http://aspnetwebstack.codeplex.com/SourceControl/network/forks/bmsullivan/prefixcontainertests/contribution/4032). I'm honestly not sure how to fix this without breaking something else or significantly impacting model-binding performance.
Comments: Yes, it does occur in a Web API context as well. I've attached a project that will easily allow you to reproduce the issue. Just open the site root in your browser, and it will make an AJAX request to the ValuesController Post method. You should see the collection property "es" come in to the controller empty. If you comment out the "esSomethingElse" property in the javascript on Index.cshtml that's making the AJAX call, you'll see the "es" property properly populated when entering the Post controller method.

Viewing all articles
Browse latest Browse all 7215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>