.NET 4.5 – Visual Studio Web Designer API bug

Recently, we developed one REST service using ASP.NET Web API. We have used a lot of ¬†async/await in that projects. Before we deploy this project on our staging web server that has a few ASP.NET 4.0 websites, we installed .NET 4.5 on one of our local server and requested QA team to test all of our existing ASP.NET 4.0 websites. I know that it’s the extra effort for our QA team but we got no choice since .NET 4.5 can’t be installed side by side with .NET 4.0. Luckily, QA reported only one issue that I am going to share in this post.

The error message that we got is as below.

Error Message: The ‘VirtualItemCount’ property cannot be set declaratively.

.NET 4.5 error

There is a custom control that we are using in our exisitng ASP.NET 4.0 project. There is the code that set VirtualItemCount in aspx but it stopped working after installing .NET 4.5 on the server.

Unfortunately, it turns out that it’s a known issue that has been reported in MS Connect. You can read about this bug report here. Microsoft didn’t mention about fixing this bug so far but there is a workaround that you can use before Microsoft release the fixes.

Workaround

In the meantime, you can apply an easy workaround which is to set the custom control’s property value in code behind and remove the affected property from the mark up.

Leave a Reply

Your email address will not be published. Required fields are marked *