Visual Studio 11 Beta in Context
Today Visual Studio 11 Beta is released and available for download. Don't want to read a big blog post? Phooey on you then! ;)
- Visual Studio 11 Beta & .NET 4.5 Beta Announcement by Jason Zander + Downloads
- Windows 8 Consumer Preview Announcement by Steven Sinofsky + Download
Made it this far? OK, cool. I wanted to do a post that would not only point you to a bunch of other resources, but more generally answer the obvious questions. The questions that I asked before I went to work for Microsoft four years ago. I always ask: What's changed, and why should I care?
"One ASP.NET"
One of the things that the fellows and I are working on that will be more obvious after the beta and even a little after the final release is this idea of One ASP.NET. We're sweeping through the whole framework, samples, templates and NuGet to make sure things work together cohesively. You'll hear more about this as we firm it up.
Some guiding principles for ASP.NET are these:
- Every reasonable combination of subsystems just works
- The model is easily extended by community projects (not just us!)
- Every subsystem or application type includes a *.Sample that works together with others
Here's the boxes diagram I've been playing with.
These principles are some of the things that drove (and continue to drive) ASP.NET this development cycle. We are trying to give you great mobile options, great HTML5, CSS3 and JavaScript support and also including open source libraries like Modernizr, jQuery, jQuery UI and Knockout.
We are working towards a more pluggable, more friendly but still powerful ASP.NET. Again, more on this soon and some surprises. We'll see more interesting uses of NuGet, more plug-ablity, more examples, and more systems working together.
You want to mix and match a ASP.NET Web API, serialization with JSON.NET, use MongoDB, run Web Pages and Web Forms side by side, add some some SignalR and a few WCF enterprise Web Services? Add in ELMAH, Glimpse, Image Resizer and your favorite NuGet packages? Totally. It's Encouraged. It's all One ASP.NET.
.NET Framework 4.5 Beta
For the most part in my experience, .NET 4.5 is a very compatible release. .NET 4.5 upgrades .NET 4 as .NET 3.5 upgraded .NET 3 (and 2, although we're trying to play by the versioning rules now, thank goodness.) The vast majority of .NET 4 apps should work fine on .NET 4.5 unless you are doing something exotic. I haven't had any problems myself, but I've heard of some unusual edge cases with folks doing ILMerge and a few other things.
There's a number of new improvements. Some of my personal favorites and features I'm most interested in are (these are somewhat obscure, but nice fixes, IMHO):
- Ability to limit how long the regular expression engine will attempt to resolve a regular expression before it times out.
- Zip compression improvements to reduce the size of a compressed file.
- Better performance when retrieving resources.
- Updates to MEF to better support generics.
- new Asynchronous methods in I/O classes for Asynchronous File Operations
- Support for Internationalized Domain Name parsing
- WPF Ribbon Control
- WCF HTTPS protocol mapping
- WCF Asynchronous streaming support
- WCF Contract-first development as well as ?singleWSDL for service URLs
Test your apps and PLEASE tell us if you have trouble. This is a beta and there is a still time to fix things.
- Application Compatibility in the .NET Framework 4.5 Developer Preview lists technologies that may cause migration issues for your application.
- What's Obsolete in the .NET Framework shows types or members that have been made obsolete, and the recommended alternatives.
- What's New in the .NET Framework 4.5 Developer Preview for descriptions of new features that you may want to add to your application.
Please don’t hesitate to post a comment on team blogs, or at one of the forums that are actively monitored: Connect (report bugs), UserVoice (request features) and MSDN Forums (ask for help). I know that folks have issues with Connect sometimes, but folks are actively monitoring all these places and are trying to get back to you with clear answers.
ASP.NET Core Framework
Here's a detailed release notes document about what's new in ASP.NET 4.5 and Visual Studio "Web Developer" 11 Beta. The core ASP.NET framework has a lot of new support around asynchrony. Asynchrony has been a theme throughout the whole Visual Studio 11 process and ASP.NET is full of improvements around this area.
There's support for the await keyword, and Task-based modules and handlers.
private async Task ScrapeHtmlPage(object caller, EventArgs e)
{
WebClient wc = new WebClient();
var result = await wc.DownloadStringTaskAsync("http://www.microsoft.com");
// Do something with the result
}
Even IHttpAsyncHandler (a classic, and a difficult thing to get right) has a friend now:
public class MyAsyncHandler : HttpTaskAsyncHandler
{
// ...
// ASP.NET automatically takes care of integrating the Task based override
// with the ASP.NET pipeline.
public override async Task ProcessRequestAsync(HttpContext context)
{
WebClient wc = new WebClient();
var result = await
wc.DownloadStringTaskAsync("http://www.microsoft.com");
// Do something with the result
}
}
There's security improvements with the inclusion of core encoding routines from the popular AntiXssEncoder library, and you can plug in your own.
ASP.NET also has WebSockets support when running on Windows 8:
public async Task MyWebSocket(AspNetWebSocketContext context)
{
WebSocket socket = context.WebSocket;
while (true)
{
...
}
}
Bundling and Minification is built in and is also pluggable so you can swap out own techniques for your own, or your favorite open source alternative.
There's lots of performance improvements including features for dense workloads that can get up to a 35% reduction in startup time and memory footprint with .NET 4.5 and Windows 8.
ASP.NET 4.5 also supports multi-core JIT compilation for faster startup and more support for tuning the GC for your server's specific needs.
ASP.NET Web Forms
There's lots of refinements and improvements in Web Forms. Some favorites are strongly-typed data controls. I blogged about this before in my Elegant Web Forms post. There's two way data-binding in controls like the FormView now instead of using Eval() and you'll also get intellisense in things like Repeaters with strongly typed modelTypes.
Web Forms also gets Model Binding (all part of the One ASP.NET strategy) which is familiar to ASP.NET MVC users. Note the GetCategories call below that will bind to a View with IQueryable.
public partial class Categories : System.Web.UI.Page
{
private readonly DemoWhateverDataContext _db = new DemoWhateverDataContext();
public void Page_Load()
{
if (!IsPostBack)
{
// Set default sort expression
categoriesGrid.Sort("Name", SortDirection.Ascending);
}
}
public IQueryable<Category> GetCategories()
{
return _db.Categories;
}
}
In this example, rather than digging around in the Request.QueryString, we get our keyword parameter this way:
public IQueryable<Product>GetProducts([QueryString]string keyword)
{
IQueryable<Product> query = _db.Products;
if (!String.IsNullOrWhiteSpace(keyword))
{
query = query.Where(p => p.ProductName.Contains(keyword));
}
return query;
}
Web Forms also get unobtrusive validation, HTML 5 updates and elements, and those of you who like jQuery but also like Web Forms Controls (as well as Ajax Control Toolkit fans) will be thrilled to check out the JuiceUI project. It's an open-source collection of ASP.NET Web Forms components that makes jQuery UI available in a familiar way for Web Forms people.
ASP.NET MVC and Web API
Last week I blogged about Making JSON Web APIs with ASP.NET MVC 4 Beta and ASP.NET Web API. ASP.NET MVC 4 includes these new features (and a few more) and is included in Visual Studio 11 Beta.
- ASP.NET Web API
- Refreshed and modernized default project templates
- New mobile project template
- Many new features to support mobile apps
- Recipes to customize code generation
- Enhanced support for asynchronous methods
- Read the full feature list in the release notes
Matt Milner has a great post on where ASP.NET Web API and WCF proper meet and diverge, and why you'd use one over the other. I'll be doing a more detailed post on this also, but I like Matt's quote:
WCF remains the framework for building services where you care about transport flexibility. WebAPI is the framework for building services where you care about HTTP.
ASP.NET Web Pages 2
New features include the following:
- New and updated site templates.
- Adding server-side and client-side validation using the Validation helper.
- The ability to register scripts using an assets manager.
- Enabling logins from Facebook and other sites using OAuth and OpenID.
- Adding maps using the Mapshelper.
- Running Web Pages applications side-by-side.
- Rendering pages for mobile devices.
There's lots more to talk about in Razor and Web Pages 2 that I will talk about when Web Matrix 2 comes out.
Visual Studio - for Web Developers
There's an extensive list of features and fixes on the Web Developer Tools team Blog. Here are my favorites.
The HTML Editor is smart about HTML5 and you can develop smart HTML5 sites with any ASP.NET technique.
The CSS Editor has a new formatter, color picker, better indentation, smart snippets and vendor-specific IntelliSense. That's Webkit and Opera in the screenshot over there.
The Javascript Editor has IE10's Javascript engine and supports Javascript as a 1st class citizen with all the support you get in other languages like Go To Definition, brace matching, and more.
Page Inspector is all new and lets you to see what elements in the source files (including server-side code) have produced the HTML markup that is rendered to the browser. IIS Express is now the default web application host.
All the Links
General Info
- The .NET Dev Center and The ReadMe
- The .NET Framework 4.5 Beta on Download Center
- What’s New in .NET 4.5 Framework
- What's new in C++
Download
- Visual Studio 11 - Web Installer
- Visual Studio 11 - ISO image
- VS 11 Beta will expire on June 30, 2012.
- Windows 8 Development Tools
- If you have Windows 8, you'll want this to developer Metro style apps.
- Team Foundation Server 11
Secondary Downloads (for the IT folks)
- .NET 4.5 Web Installer
- Language Packs
- Full Redist
- Go-Live Statement
- What about Azure work on "Visual Studio 11?" Details here.
Got Visual Studio issues? Complain (kindly) and vote up features and concerns at their UserVoice site.
Got ASP.NET issues? Complain to me (kindly) and vote up features and concerns at our UserVoice site or ask questions in the ASP.NET forums. There will also be new videos, tutorials and information at http://asp.net/vnext and we are continuing to update the site with fresh content.
Hope you enjoy the Beta. Please do take a moment to install it, try it out, and offer feedback. There is time for us to make changes, fixes and improvements but only if you give feedback.
Sponsor: My thanks to DevExpress for sponsoring this week's feed. There is no better time to discover DevExpress. Visual Studio 11 beta is here and DevExpress tools are ready! Experience next generation tools, today.
About Scott
Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.
About Newsletter
http://blogs.msdn.com/b/webdevtools/archive/2012/02/29/new-features-for-web-development-in-visual-studio-11-beta.aspx
How about an HTML5/CSS3, JavaScript project type without ASP.NET MVC when you are just doing standards based development? JetBrains WebStorm has it.
Full VS 11 Beta includes and installs all that one need for windows 8 metro-style development, so I think for many people who anyway will use full VS11 this would be preferable option.
thanks,
s.
So, how about an HTML5/CSS3, JavaScript project type without ASP.NET MVC when you are just doing standards based development?
s.
Or is the system requirements still in progress too?
The default drive doesn't have enough space for it, too bad !
Simple little wrappers around pulling values out by key. Easy enough, works great on every machine we've got that doesn't have VS11 beta installed.
With the VS11/.NET 4.5 installed, this.Session property of WebViewPage returns null when accessed within this scope.
Hacking around it right now with:
public new System.Web.HttpSessionStateBase Session
{
get
{
return this.ViewBag.Session;
}
}
then in our BaseControllers OnActionExecuting populating it..
Is this an intentional change or did we stumble on an issue?
VS11 looks great at least.
I'm hit by the same issue as Brandon Stirnaman above: my WebViewPage instances access the .Session property. Now that .Session property is null. Prior to VS11 upgrade, .Session wasn't null.
I can work around it, but this is definitely a breaking change.
Bug?
ie. would like to see a ps console as well - should be able to fire up a node project within VS and get all the js/css support without .net
like WebStorm - good stuff!
http://msdn.microsoft.com/en-us/library/hh420390(v=vs.110).aspx#related_webstack_2
The following products are not included in Visual Studio 11 Beta, but they are available separately as free downloads.
ASP.NET MVC 4.0 Beta
Separate versions of the ASP.NET MVC 4.0 Beta are available for Visual Studio 2010 and Visual Studio 2011 Beta at ASP.NET MVC 4 Beta.
The Javascript IDE space is exploding with opportunity and Visual Studio and .Net are slow to catch up.
Node.js is taking over the web space (with good reason), it is time to dump asp.net forms and move on.
Why is this db relative to the page? Why is not disposed?
Why is not relative to good practices( obtain later, dispose early)?
More, it encourages thinking the new programmers that , if they obtain an object in GET, it will be available on posting page ?
public partial class Categories : System.Web.UI.Page
{
private readonly DemoWhateverDataContext _db = new DemoWhateverDataContext();
I see this over and over again - in MVC and WebForms... And I do not think that using will be difficult to do it.
More, who will dispose connection on
public IQueryable<Product>GetProducts([QueryString]string keyword)
?
Or 1000 requests will do 1000 database connections disposed on Garbage Collector?
Here's the correct link:
http://www.microsoft.com/download/en/details.aspx?id=28975
Judah and Brandon - I'm having the team look at this now.
Drazan - I believe it's how Web Sockets support is in Windows 8 but I'll have an Web Sockets expert comment.
It also for some reason automatically migrates projects to new version? WTF?
And if that is not enough, it has all kinds of weird bugs. It does work hoever if I have VS2010 installed aswell.
I'm going to try install VS2010 for my Windows 8 Consumer Preview aswell and see if that fixes those bugs, but so far, very unstable realease.
How is one suppose to write Metro apps with that? :(
What's the deal with moving from Beta to RTM further down the line? Do i need to do a much of registry hacks /uninstalls to get RTM installed over beta?
Would like to install on my work machine but fearful of the above.
Thanks
Is there any possibility to have Metro style UI for Web? i mean it would be cool if we can see Metro UI on web. Any plans in future?
thanks
thanks
I'm sure you know that, if using EF there, each time an IQueryable is "executed", a database connection is indeed opened and closed, more precisely, is get from the connection pool and returned to the pool, so the overhead should be minimal.
Thanks for the speedy response regarding the WebViewPage.Session bug. We appreciate it.
Frank Wu
So I installed .NET 4.5 beta on my machine, and yup immediately my application stopped working.
Please find the code below that throws the error.
ConstructorInfo mailWriterContructor = mailWriterType.GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic, null, new[] { typeof(Stream) }, null);
object mailWriter = mailWriterContructor.Invoke(new object[] { stream });
MethodInfo sendMethod = typeof(MailMessage).GetMethod("Send", BindingFlags.Instance | BindingFlags.NonPublic);
sendMethod.Invoke(message, BindingFlags.Instance | BindingFlags.NonPublic, null, new[] { mailWriter, true }, null);
The error occurs on the last line sendMethod.Invoke(....
Here is the error:
System.Reflection.TargetParameterCountException: Parameter count mismatch.
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at .......
at .......
at System.ServiceProcess.ServiceBase.ServiceQueuedMainCallback(Object state)
If this can be looked at ASAP that would be greatly appreciated so I can decide if I should uninstall .NET 4.5 or if there is a workaround.
regarding Websockets support...
I understand that the easy route was to say "let's fall back to the system implementation of Websockets", where "system" in this case is IIS8, but since IIS8 runs on Windows 8 only...
Basically, Microsoft is telling us that if we want Websocket support now we should look elsewhere because God knows how long it'll be till Windows 8 Server becomes available. Worse, if you plan on hosting on Azure, who can say how long it'll take till Server 8 gets deployed there?
Seeing how complex/easy it would have been to implement this functionality on IIS 7.5 (the protocol isn't *that* complicated), I'm simply disappointed that the devs took the "lazy" route.
If you look at SignalR, you'll see that their Websocket support also falls back to IIS8 and the above restrictions apply.
This is, for certain scenarios (and mine is unfortunately one of them) a deal breaker.
Note that the .NET Framework 4.5 Beta is not supported on Windows XP and Windows Vista.
I hope that's a limitation of the beta, and not an indication of the requirements for the final release.
What would be the point of an in-place upgrade which will only upgrade some of the installations? If the OS supports 4.0, it should support 4.5 as well.
I could sort-of understand .NET 3.0/3.5 not working on W2K because it wouldn't support WPF. But I don't see anything in the "what's new" links which would justify dropping XP, let alone Vista.
I guess what I'm trying to say is, "Upgrade ALL the things!"
Drazan - Well, SignalR supports not just Long Polling, but also Server Sent Events and Forever Frame as well as WebSockets. Point is, you can use it now, happily, and websockets will just turn on when it can. I suspect that Azure will support it sooner than you think.
Dom - Doesn't look like any movement on XSLT 2 from what I can find out. There are three 3rd party libraries and options for XSLT 2 on .NET today: http://www.codeproject.com/Articles/304467/XSLT-2-0-in-NET
Chris - yes, the Go Live License for .NET 4.5 is here.
Michael - We spoke offline and since you are using reflection to talk to a private internal API, that's not a breaking change per se. That said, we worked it out and you can call a public API now. :)
Frank - You need Windows 8 to do Metro style development.
Anton - Word on the street is that this VS11 Beta uninstalls very cleanly in easy fashion, so I suspect that the upgrade path will be easier. I haven't needed to torch my system yet.
I accidently didn't show all the specific code above to properly debug this issue, but yes a private API (System.Net.Mail.MailWriter and System.Net.Mail.MailMessage.Send) was been used which changed.
I fixed the issue by adding an extra "true" parameter for the Send method.
Assembly assembly = typeof(SmtpClient).Assembly;
Type mailWriterType = assembly.GetType("System.Net.Mail.MailWriter");
using (MemoryStream stream = new MemoryStream())
{
ConstructorInfo mailWriterContructor = mailWriterType.GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic, null, new[] { typeof(Stream) }, null);
object mailWriter = mailWriterContructor.Invoke(new object[] { stream });
MethodInfo sendMethod = typeof(MailMessage).GetMethod("Send", BindingFlags.Instance | BindingFlags.NonPublic);
sendMethod.Invoke(message, BindingFlags.Instance | BindingFlags.NonPublic, null, new[] { mailWriter, true, true }, null);
}
I'm a Microsoft program manager and I've worked on WebSockets for the past year. The WebSockets implementation in Windows 8 is a bit more complicated than you might think. We had to make changes to both HTTP.SYS and the internal IIS pipeline (in addition to other layers, such as ASP.NET). It would be a large amount of work with some significant risks attached to attempt to backport and patch these changes into earlier versions of HTTP.SYS and IIS.
Now don't get me wrong, I agree that it would be great to have WebSockets working in IIS 7.5. The Windows 8 requirement is frustrating. But lets be clear - at Microsoft we have invested significant effort into implementing WebSockets across our platform and that work continues today as we harden our implementation in terms of performance and stress. I think characterizing us as 'lazy' is unfair.
Thanks!
thanks for replying! Good to hear from someone working on WebSockets for Windows.
I apologize if I've sounded too harsh.
But then again, when you look at all those open surce projects supporting WS (like socket.io) one wonders - was that really something that required Windows 8? How come all these other guys did not need to rely on Windows 8 features?
I understand that open source projects are usually not as tested and they aren't nearly as documented as Microsoft products, so for everyone else it's much easier to just go ahead and work on features. But looking at their performance figures they don't seem so bad, and they definitely run on all kinds of platforms no problem.
All I'm saying is that I think Microsoft is shooting itself in the foot. Nobody in their right mind is going to buy Windows 8 (Server) in order to get Websockets support. Note that I'm talking about server here, on the client things are just fine with multiple browsers supporting the protocol (and some, lo and behold, even run on Windows XP!). Why do I say browsers? Because with rich client applications I can just use regular sockets.
Sorry, but I still see this as an artificial way to try to sell Windows (and I'm guessing this is a policital move that has nothing to do with you or your team).
Once again, don't take this personally. I have nothing but respect for the good people developing cool solutions on Windows platform. But if you restrict it to Windows 8, it's gonna take several years from this very instant till people get a chance to seriously evaluate using the technology you're working on. Things like this would, to me as a developer, be depressing.
Thanks again for taking the time to comment here.
Well, SignalR supports not just Long Polling, but also Server Sent Events and Forever Frame as well as WebSockets. Point is, you can use it now, happily, and websockets will just turn on when it can. I suspect that Azure will support it sooner than you think.
Yes, I am aware of the fact that SignalR supports other "transports". But frankly these are all hacks, and the industry as a whole has been waiting for a real sockets support in the browser for a long time. Now that browsers support it (or will very soon) we need the server to play along. And when I say we, I don't mean everyone, but because I'm in the financial industry and here it's all about realtime quotes deliverly, "we" definitely need WS support sooner rather than later.
But while I don't want to drag this on further, you've been kind responding to me, I do have one more question: when you say "Azure is going to support it sooner than I think" - what are we talking about? Deployments of Windows Server 8 on Azure? Deployment of IIS8 on earlier versions of Windows Server?
Btw, do I understand correctly that IIS8 will only run on Windows (Server) 8?
Thanks again for the info.
One thing you aren't taking into consideration is the difference between building a separate WebSockets library vs integrating WebSockets into an existing technology stack. If you search you'll quickly find a few different .NET libraries that are capable of accepting WebSocket connections (Fleck is a popular one). One of the most important differences between these and the .NET 4.5 implementation is that these libraries will never be integrated with IIS, which means you would always have to run your WebSocket traffic on a different port to IIS, there is more work involved in configuring SSL, etc.
But aside from this point I do get where you are coming from. You're not the first to express these sentiments and you won't be the last, not by a long shot! I just wanted to point out that there ARE significant technical hurdles when it comes to getting the .NET 4.5 WebSocket server capabilities working on earlier versions of Windows and IIS.
One of the most important differences between these and the .NET 4.5 implementation is that these libraries will never be integrated with IIS, which means you would always have to run your WebSocket traffic on a different port to IIS, there is more work involved in configuring SSL, etc.
This list is only partially true. The integration with IIS isn't gonna be there, you're right, but running on a different port is not hard at all, thanks to the HTTP.SYS. We've been running our own HTTP server concurrently with IIS on port 80 on the same machine for three years (admittedly, on a recent version of Windows, Server 2008 R2).
Also, you're right configuring SSL is going to be harder as well. We could run our own encryption though, it's not too hard (but I do prefer IIS and 'regular' SSL, less work and easer to configure using existing management tools).
It's a shame Microsoft appears to use tactics like this and ambiguity surrounding availability of IE10 on "older" versions of Windows, to sell us Windows 8.
I don't need persuading, I've been using new versions of Windows as soon as they come out for more than 15 years. But where am I going to find a hoster that'll run Windows 8 Server? Personally, I'm probably gonna run my future business on Azure, so theoretically Azure will auto-update to 8 sooner rather than later (at least that's what Scott is sort-of implying), but what about all those that will use "classic" hosting?
In any case, thanks again for being open and direct.
I think your argument about sharing port 80 between IIS and your own web server is off the mark because in this case we are talking about WebSocket traffic, not normal HTTP traffic. I am happy to be proven wrong but to the best of my knowledge its impossible to run WebSocket traffic through pre-win8 HTTP.SYS, and therefore its impossible to run WebSocket traffic on the same port as IIS without Windows 8.
Same problem as @Bill Williams (01 March 2012 02:19:15 UTC): the VS2011 Ultimate HTML Editor appears to have a significant problem. All one needs to do is open up a .CSHTML file and play around it for a few seconds and: "Bang".
I've had about 8-10 crashes so far today.
There is also a spurious error in the error list, which may be related:
"'System.Web.WebPages.Html.HtmlHelper' does not contain a definition for 'Partial' and no extension method 'Partial' accepting a first argument of type 'System.Web.WebPages.Html.HtmlHelper'". This is spurious because the solution is building fine.
Is there someone I can contact regarding this?
Thanks.
Azure folks, here's the offical word on Azure on Dev11. http://www.windowsazure.com/en-us/develop/vs11/
We don't need the C++ stuff. There should be option to select the module(s) which we need. Isn't it would be much better?
Thanks From Kuwait
Out of everything I have seen mentioned about the new VS11 my FAVORITE thing is opening up class files in a tree view and going directly to a method without having to open the file and look for it.
Simple thing but AMAZING!!
may seem odd to gush about such a small thing but it really has made my day.
Comments are closed.