Visual Studio 2010
Scott showed quite a lot of enhancements in VS2010 that I was not aware of, and that I’m sure I will use a lot in the future.
- Scott used the source code for MVC to show off some code navigation techniques.
- Multimonitor support now means that you can drag tool windows out of VS main window an on to another monitor.
- When selecting a variable, all other usages of that variable are also lightly highlighted.
- Intellisense filtering means that what you type does not have to be the beginning of the class/method.
- Intellisense is also smart about camel and pascal casing in members, so that you can use the abbreviation consisting of all first letters. Example: you can insert a call to GetParamValue by just typing GPV.
- New dialog “Navigate to” with shortcut Ctrl+, [not sure exactly what the advantage is]. New intellisense features work here too.
- View Call Hierarchy is a new command to not only view all calls to a specified method (via view all references) but also view what methods call those methods and so on up the call tree. Great feature!
- Generate Sequence Diagram is a new command to generate a visual representation of the method calls. Looked quite complex (visually) so I’m not sure how much value this will be. But you can also draw/comment on top of that visual interface so could maybe be good for code reviews? Got applause from the audience.
- Vertical selection by holding down the Alt key and selecting with the mouse is nothing new, but now, I you start typing, you can also replace all selected row-columns with what you type. Got laughs from the audience.
- Snippets now supported in html editor. Almost all asp.net controls now have snippet with some default attribute values. Type “runat” and then tab, tab, and you don’t have to type “server”. Also supported in javascript files (with tab between placeholders and so on).
- There will be (is?) an online gallery of snippets.
- Intellitrace is a new feature while debugging. Is a tool window with messages about what has happened during the debugging so far. Not just a call stack, but trace messages such as a certain event has been fired.
- Debugging now also supports going backward! If you’ve debugged past some place, you can now step back line by line and restore the executing context back in time. Great feature!
- If running a crashing application on a remote machine, you can start that application with a special tool that will dump everything about the execution into a file which you can later load in your debugging environment and see what actually happened. Not sure exactly how much info is contained. I guess you can’t set breakpoints anywhere in the execution context before the crash/exception actually happened? Also called the “Flight recorder feature”. Can also include video recordings of the screen before the crash and have the crash dump attached.
ASP.NET 4 (and more)
ASP.NET also has some really good improvements, although maybe not as surprising as the Visual Studio ones.
- .NET 4 is a side-by-side release, which means that it does not replace any existing .NET files. This was also the case when .NET 2.0 was released and could exist side-by-side with .NET 1.1. .NET 4 is however also backwards compatible and should be able to run all 2.0, 3.0, 3.5 code. After install, IIS has separate application pool for .NET 4.
- New project types “Empty” that does not contain any sample/starter files.
- Cleaner web.config (second element in beta 2 will go away in release version).
- Separate configuration in files such as web.debug.config and web.release.config.
- Cleaner html for all controls. No inline styles from controls (if not explicitly set).
- ClientIDMode new attribute on controls to better control the id of the resulting html element.
- Better control over ViewState, app/page level per control (type?).
- VS2010 designer supports CSS 2.1.
- URL Routing support. Set in Application_Start: RouteTable.Routes.MapPageRoute. Answer to question about routing configuration was negative (not supported in product – but third party code exists [of course]).
- Meta-tag api for setting Page.Description and Page.Keywords (for instance, in master/content pages).
- New Response-methods RedirectPermanent (301) and RedirectToRoute.
- IIS SEO Toolkit is downloadable and installs in IIS Manager where you can run an analysis of how seo-friendly a site is. The analyzed site does not have to be in IIS – can be any site. (Strage placement of the tool, then?)
- Chart controls included.
- QueryExtender control for help with sorting and filtering in the user interface of queries from the server.
- Dynamic Data has lots of features.
- Web form controls data validation can look at data model attributes to perform its validation.
- Scott does not run the ADO.NET framework team, but some news nonetheless: Model first, Lazy loading, Plural/singular, Foreign keys, T4 templates, Disconnected api.
- VS2010 JavaScript intellisense improved. Extremely impressive handling of interpreting code such as setting a window variable one way, and listing it in intellisense list thereafter. Example: window["Test"] = “x” means that the variable Test will be known as window variable and presented in intellisense drop down in that context.
- CDN (Content Delivery Network) hosting available for Microsoft Ajax Library and jQuery.
- VS environment profile “Web Development Code Optimized” where design-tab for aspx-files has been removed (among other things). Can also be set from Tools, Options.
- ASP.NET Core is the name for the parts that ASP.NET WebForms and ASP.NET MVC share.
- AppFabric for your Windows Servers will ship next year and includes Velocity for memory caching. Interesting, haven’t heard about Velocity in quite some time!
- <%: str %> automatic html encoding.
MVC
With MVC, Scott takes a little bit more time to explain the basics. From an audience poll it is evident that the previous experience of MVC is very different amongst the people in the audience.
- VS2010 uses templates according to the T4 templating engine a lot, which includes MVC.
- Normal sequence is to first add a controller and than a view.
- Routing rule sample “/Browse/{category*}”, the * means that everything after “/Browse/” will be included in parameter “category” value.
- Create view dialog box has drop down for different views, which are generated by T4 templates.
- Other http verbs such as [HttpDelete] for an action method can be simulated in a web form by a hidden field (automatically).
- Data annotation can be used in the model to specify validation rules. Found in namespace System.ComponentModel.DataAnnotation.
- [Required]
- [Required(Message="Must type")] – can localize messages in resource. [How to do it if you want to store translations in database?]
- Html.ValidationMessageFor specifies the place to put the validation error message in html.
- Html.EnableClientValidation inserts javascript in page that performs the same validation on the client side.
- Client side validation has support for calling web service for validation.
- Validation rules does not have to be attributes in the data model. Can be pulled from anywhere, like xml files. Brad Wilson has sample (blog post?).
- Html.EditorFor and Html.DisplayFor can output complete display/form. Takes lambda expression to specifiy the field to generate html for.
- Demoing putting Product.ascx in EditorTemplates folder for customization of Html.EditorFor.
- [UIHint("name")] on CategoryId field can be used to accomplish drop down list for a foreign key.
- Areas new feature: encapsulation of controllers, models and views.
- Asynchronous controllers.
- “Unit testing is about confidence to add features” (not only catching bugs).
- Demoing unit test with pattern Arrange, Act, Assert (what to do in the unit test method).
- Uses a “fake” to factor out database dependency in unit test (doesn’t work correctly).
- TDD (Test Driven Development) support in VS2010 via a few features: consume first intellisense can be turned on with Ctrl+Shift+Space [I think], where intellisense does not “get in the way” when typing code for classes and methods that does not exist yet.
- Generate Class From Usage command. [Did however not generate the method for which there was a call.]
- MVC has a controller factory pattern [no details].
- For BDD (Behavior Driven Design) third party frameworks exist (nothing in VS).
T4 is interesting and should be looked at more closely to adjust how what autogenerated code actually contains. As someone in the audience pointed out, however, the tooling support in VS for T4 is very (very) low. Not even color coding of T4 (“.tt”) files!
Silverlight 4
The Silverlight talk was the last of the day and did not contain that much demos or code. In fact, Scott talked quite a lot about already built Silverlight apps and sites using Silverlight. It was more about the end result, than on details on how to get there. But interesting nonetheless.
- Microsofts programs for developers to get application licenses: BizSpark, WebsiteSpark (websitespark.com).
- Expression 3 Blend contains Sketchflow. Sketchflow Player shortly demoed. Impressive annotation capabilities, for instance when showing a sketch to a customer. Can save to Word document. Even used by some Flash agencies, so it seems Sketchflow is the first Microsoft application to make it into the visual designer space?
- Sunday night football player is impressive Silverlight application for controlling live tv on your own. Source code available on CodePlex.
- Bloomberg other company that builds on Silverlight.
- Demoing Webcam capabilities with a Silverlight app (name “archetype”??). The same as he did in the PDC keynote with funny snapshot of his forehead.
- IIS Media Services can be installed via Web Platform Installer.
- IIS Smooth Streaming can adjust bitrate according to network and local cpu utilization.
- Other areas with new support in Silverlight 4:
- Printing
- Rich text (showed a nice Silverlight Text Editor – source code?)
- Clipboard
- Right click [wasn't aware that this was missing]
- Mouse wheel
- Drag and drop between Silverlight and operating system.
- Html control – can be used as a brush – showing demo (also from PDC) with Rick Astley on youtube and with the video still running after html control has been split up into puzzle pieces. However, I dont’t think you can interact with the html surface in that way?
- Shared binary assemblies between .NET and Silverlight (no recompilation).
- UDP, REST, WCF RIA Services.
- Elevated trust: windowing with custom chrome.
- Running code twice as fast as Silverlight 3.
- Profiling support.
- Silverlight feature voting on User Voice.
- Release Candidate in early 2010, final release later [dare we guess at Mix10?]
In a response to a question about Silverlight versus WPF, Scott saids that there is a new Office app coming out that is built on WPF. No more details though.
Leave a Reply
Great information for all of us who wasn’t there. Thanks!
A personal perspective:
http://fragiledevelopment.wordpress.com/2009/12/03/scott-guthrie-in-stockholm/
The more interesting answer in my opinion was that in regard to the “Silverlight for Windows Mobile” question.