Posted on Leave a comment

ASP.NET Core 2.2.0-preview1: Endpoint Routing

What is it?

We’re making a big investment in routing starting in 2.2 to make it interoperate more seamlessly with middleware. For 2.2 this will start with us making a few changes to the routing model, and adding some minor features. In 3.0 the plan is to introduce a model where routing and middleware operate together naturally. This post will focus on the 2.2 improvements, we’ll discuss 3.0 a bit further in the future.

So, without further ado, here are some changes coming to routing in 2.2.

How to use it?

The new routing features will be on by default for 2.2 applications using MVC. UseMvc and related methods with the 2.2 compatibility version will enable the new ‘Endpoint Routing’ feature set. Existing conventional routes (using MapRoute) or attribute routes will be mapped into the new system.

public void ConfigureServices(IServiceProvider services)
{
 ...
 
 services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
}

public void Configure(IApplicationBuilder app)
{
 ....
 
 app.UseMvc();
}

If you need to specifically revert the new routing features, this can be done by setting an option. We’ve tried to make the new endpoint routing system as backwards compatible as is feasible. Please log issues at https://github.com/aspnet/Routing if you encounter problems.

We don’t plan to provide an experience in 2.2 for using the new features without MVC – our focus for right now is to make sure we can successfully shift MVC applications to the new infrastructure.

Link Generator Service

We’re introducing a new singleton service that will support generating a URL. This new service can be used from middleware, and does not require an HttpContext. For right now the set of things you can link to is limited to MVC actions, but this will expand in 3.0.

public class MyMiddleware
{
 public MyMiddleware(RequestDelegate next, LinkGenerator linkGenerator) { ... }
 
 public async Task Invoke(HttpContext httpContext)
 {
 var url = _linkGenerator.GenerateLink(new { controller = "Store",
 action = "ListProducts" });
 
 httpContext.Response.ContentType = "text/plain";
 return httpContext.Response.WriteAsync($"Go to {url} to see some cool stuff.");
 }
}

This looks a lot like MVC’s link generation support (IUrlHelper) for now — but it’s usable anywhere in your application. We plan to expand the set of things that are possible during 2.2.

Performance Improvements

One of the biggest reasons for us to revisit routing in 2.2 is to improve the performance of routing and MVC’s action selection.

We still have more work to, but the results so far are promising:
image

This chart shows the trend of Requests per Second (RPS) of our MVC implementation of the TechEmpower plaintext benchmark. We’ve improved the RPS of this benchmark about 10% from 445kRPS to 515kRPS.

To test more involved scenarios, we’ve used the Swagger/OpenAPI files published by Azure and Github to build code-generated routing benchmarks. The Azure API benchmark has 5160 distinct HTTP endpoints, and the Github benchmark has 243. The new routing system is significantly faster at processing the route table of these real world APIs than anything we’ve had before. In particular MVC’s features that select actions such as matching on HTTP methods and [Consumes(...)] are significantly less costly.

Improvements to link generation behavior for attribute routing

We’re also using this opportunity to revisit some of the behaviors that users find confusing when using attribute routing. Razor Pages is based on MVC’s attribute routing infrastructure and so many new users have become familiar with these problems lately. Inside the team, we refer to this feature as ‘route value invalidation’.

Without getting into too many details, conventional routing always invalidates extra route values when linking to another action. Attribute routing didn’t have this behavior in the past. This can lead to mistakes when linking to another action that uses the same route parameter names. Now both forms of routing invalidate values when linking to another action.

A conceptual understanding

The new routing system is called ‘Endpoint Routing’ because it represents the route table as a set of Endpoints that can be selected by the the routing system. If you’ve ever thought about how attribute routing might work in MVC, the above description should not be surprising. The new part is that a bunch of concerns traditionally handled by MVC have been pushed down to a very low level of the routing system. Endpoint routing now processes HTTP methods, [Consumes(...)], versioning, and other policies that used to be part of MVC’s action selection process.

In contrast to this, the existing routing system models the application is a list of ‘Routes’ that need to be processed in order. What each route does is a black-box to the routing system – you have to run the route to see if it will match.

To make MVC’s conventional routing work, we flatten the list of actions multiplied by the number of routes into a list of endpoints. This flattening allows us to process all of MVC’s requirements very efficiently inside the routing system.


The list of endpoints gets compiled into a tree that’s easy for us to walk efficiently. This is similar to what attribute routing does today but using a different algorithm and much lower complexity. Since routing builds a graph based on the endpoints, this means that the complexity of the tree scales very directly with your usage of features. We’re confident that we can scale up this design nicely while retaining the pay-for-play characteristics.

New round-tripping route parameter syntax

We are introducing a new catch-all parameter syntax {**myparametername}. During link generation, the routing system will encode all the content in the value captured by this parameter except the forward slashes.
Note that the old parameter syntax {*myparametername} will continue to work as it did before. Examples:

  • For a route defined using the old parameter syntax : /search/{*page},
    a call to Url.Action(new { category = "admin/products" }) would generate a link /search/admin%2Fproducts (notice that the forward slash is encoded)
  • For a route defined using the new parameter syntax : /search/{**page},
    a call to Url.Action(new { category = "admin/products" }) would generate a link /search/admin/products

What is coming next?

Expect more refinement and polish on the LinkGenerator API in the next preview. We want to make sure that this new API will support a variety of scenarios for the foreseeable future.

How can you help?

There are a few areas where you can provide useful feedback during this preview. We’re interested in any thoughts you have of course, these are a few specific things we’d like opinions on. The best place to provide feedback is by opening issues at https://github.com/aspnet/Routing

What are you using IRouter for? The ‘Endpoint Routing’ system doesn’t support IRouter-based extensibility, including inheriting from Route. We want what you’re using IRouter for today so we can figure out how to accomplish those things in the future.

What are you using IActionConstraint for? ‘Endpoint Routing’ supports IActionConstraint-based extensibility from MVC, but we’re trying to find better ways to accomplish these tasks.

What are your ‘most wanted’ issues from Routing? We’ve revisited a bunch of old closed bugs and brought back a few for reconsideration. If you feel like there are missing details or bugs in routing that we should consider please let us know.

Caveats and notes

We’ve worked to make the new routing system backwards compatible where possible. If you run into issues we’d love for you to report them at https://github.com/aspnet/Routing.

DataTokens are not supported in 2.2.0-preview1. We plan to address this for the next preview.

By nature the new routing system does not support IRouter based extensibility.

Generating links inside MVC to conventionally routed actions that don’t yet exist will fail (resulting in the empty string). This is in contrast to the current MVC behavior where linking usually succeeds even if the action being linked hasn’t been defined yet.

We know that the performance of link generation will be bad in 2.2.0-preview1. We worked hard to get the API definitions in so that you could try it out, and ignored performance. Expect the performance of URL generation to improve significantly for the next preview.

Endpoint routing does not support WebApiCompatShim. You must use the 2.1 compatibility switch to continue using the compat shim.

Posted on Leave a comment

LibMan CLI Released

The Command Line Interface (CLI) is now available for Microsoft Library Manager (LibMan) and can be downloaded via NuGet. Look for Microsoft.Web.LibraryManager.Cli
The LibMan CLI is cross-platform, so you’ll be able to use it anywhere that .NET Core is supported (Windows, Mac, Linux).

Install the LibMan CLI

To install LibMan, type:

> dotnet tool install --global Microsoft.Web.LibraryManager.Cli

Once the LibMan CLI is installed, you can start using LibMan from the root of your web project (or any folder).

Using LibMan from the Command Line

When using LibMan CLI, begin commands with “libman” then follow with the action you wish to invoke.
For example, to install all files from the latest version of jquery, type:

> libman install jquery

Follow the prompts to select the provider and destination. Type the values you want, or press [Enter] to accept the defaults.

The install operation creates a libman.json file in the current directory if one does not already exist, then adds the new library configuration. It then downloads the files and places them in the destination folder. See the example below.

LibMan CLI example

To learn more about the LibMan CLI, refer to the LibMan CLI documentation on the Library Manager Wiki.

Happy coding!

Justin Clareburt, Senior Program Manager, Visual Studio

Justin Clareburt (justcla) Profile Pic Justin Clareburt is the Web Tools PM on the Visual Studio team. He has over 20 years of Software Engineering experience and brings to the team his expert knowledge of IDEs and a passion for creating the ultimate development experience.

Follow Justin on Twitter @justcla78

Posted on Leave a comment

Improvements in Visual Studio 2017 15.8 for web developers

This week we released Visual Studio 2017 version 15.8. Our 15.8 update brings the following improvements for web developers:

  • Custom docker image tags during Publish
  • Zip push deployment for Azure Functions
  • Managing user secrets in ASP.NET Framework projects (targeting .NET 4.7.1 or higher)
  • Enabling Application Insights as part of publishing to Azure App Service
  • Optimizing build performance for solutions containing ASP.NET Framework projects
  • Author and source information for ASP.NET Core templates

Custom docker image tags during Publish

You can now customize the “Image tag” for Docker containers when publishing them to a container registry. The value can either be automatically generated by Visual Studio every time you publish (the previous behavior), or it be manually changed if you need a consistent tag (e.g. “latest”):

Screenshot of new property called "Image Tag" in Publish

Zip push deployment & run from zip for Azure Functions

Visual Studio now provides the option to deploy and run Azure Functions projects as zip files:

Screenshot of publish and run from zip option in Publish

Run-From-Zip is a runtime feature that allows ‘mounting’ a zip file and running directly from it. Your App runs directly over the ‘mounted’ zip file, which completely takes over your wwwrootfolder (which becomes read-only).  Using run from Zip offers the following benefits:

  • Atomicity: when your application is deployed as as single unit, and updated as a single unit meaning publishing an update will never leave your app in a partially updated state
  • Faster deployment of large applications
  • Improved cold start performance

Managing user secrets in ASP.NET Framework projects (targeting .NET 4.7.1 or higher)

A feature that ASP.NET Framework projects were missing compared to ASP.NET Core was support for storing application secrets (e.g. connection strings, API keys, etc.) in a file outside of source control unique to each user. Now, with .NET Framework 4.7.1 and Visual Studio 15.8 it’s as simple as right clicking on the project in Solution Explorer and selecting “Manage User Secrets”:

Screenshot of the new "Manage user secrets" menu item when right clicking in Solution Explorer

Visual Studio will take care of the rest including downloading the necessary NuGet packages, updating the web.config file, creating the secrets file on disk and finally opening it for you to edit:

Screenshot of an example user secrets file

Note: Only available for projects targeting .NET Framework 4.7.1 or higher, if you can’t see the menu item make sure you have the 4.7.1 targeting pack installed and that the project is actually targeting 4.7.1, you can change it from project properties:

Screenshot of the run time drop-down available in project properties

Enabling Application Insights as part of publishing to Azure App Service

When publishing to Azure App Service, Visual Studio asks you to either create a new App Service or re-use an existing one. If you choose to create a new App Service to host your application, Visual Studio now offers you the ability to also provision and configure Application Insights:

Screenshot of new drop-down related to Application Insights when creating a new App Service

All you need to do is pick the region you would like Application Insights to be provisioned in and Visual Studio will make sure it’s configured to pick up telemetry events and metrics from the new App Service. If you wish to add custom events and metrics follow this guide. Of course, you can always set the field to “None” and Visual Studio will not provision nor configure Application Insights on your behalf.

Optimizing build performance for solutions containing ASP.NET Framework projects

We added a new menu item under Build | ASP.NET Compilation | Optimize Build Performance for Solution:

Screenshot of new menu item Build | ASP.NET Compilation | Optimize Build Performance for Solution

This new menu item is applicable to solutions containing ASP.NET Framework projects only and is not applicable to ASP.NET Core projects. Its purpose is to update specific ASP.NET related NuGet packages referenced by the codebase.

When an ASP.NET Framework codebase is using out-of-date packages, the inner loop performance of Visual Studio is impacted. The motivation behind updating these packages is to restore optimal inner loop performance for a given solution.  You will only have to do this once per solution and you will not have to deal with this problem in the future since the new package is designed in a way that even when it gets out of date it doesn’t affect the inner loop performance in Visual Studio.

Author and source information for ASP.NET Core templates

The dialog for new ASP.NET Core projects now shows you the author and source for the selected template:

Screenshot of author and source information available in the New Project Dialog

  • If the template is coming from a .NET Core SDK installed on the machine, the dialog will now display the version of the SDK as the source
  • If the template is coming from a VSIX (i.e. Visual Studio extension) installed on the machine, the dialog will now display the name of the VSIX as the source

Conclusion

If you’re interested in the many other great things that Visual Studio 2017 15.8 brings, check out our Visual Studio 15.8 post on the Visual Studio blog.

We hope that you’ll give 15.8 a try and let us know how it works for you. If you run into any issues please report them using Visual Studio, or let us know what you think below, or via Twitter.

Posted on Leave a comment

PHP 7.0.31 is available

Hi, The PHP development team announces the immediate availability of PHP 7.0.31.. This is a security release. Several security bugs has been fixed in this release. All PHP 7.0 users are encouraged to upgrade to this version. For source downloads of PHP 7.0.31 please visit our downloads page: http://www.php.net/downloads.php Windows binaries can be found on http://windows.php.net/download/ The list of changes is recorded in the ChangeLog: http://www.php.net/ChangeLog-7.php#7.0.31 Regards, Anatol Belski and Ferenc Kovacs P.S. Below is the verification information for the downloads php-7.0.31.tar.bz2 SHA256 hash: 7e8bd73eced6e679a179d39571e8fee6c83e51c86f43338f65c2dc88c1106b91 PGP signature: -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEGk6LcnfELlPbqce5vKow6pwNV2MFAltN0GAACgkQvKow6pwN V2OrOgf9G8vHzgiBO4mRQczBKqcCl4hpBD1YJ5AHCNOf0+sPHTxRXN5Mqss9T3pe PIJfBW3xxsEkAI/RzwXhRc9m6sEuqoPYT6Mp3i0oFuUK+YCNUXEgayi7ry408GMB 5if/iq3tH7S0pbgjKV4y48CiXJb8/V8zfV7asgRoSoSCb2CnSjrZGlwGLMSIh3NL Xt+Sg0G8xLgzxPboTJpCDA2EGUsFBjuv8IGFGD9vAfMKzNR/ZqTRl85Q2NuIMFEV yHHyxcAkjbC6/69lYntY0ZMgc4BhC6Mr1vXBuvyRn/M5U9eQaNfsjpHPi9rcm6M2 PT3K6Qf4LsDvTXJU81w9DuM4IJXuoA== =1BRy -----END PGP SIGNATURE----- php-7.0.31.tar.gz SHA256 hash: 182f36e5709837158bd4970ce57fe80735bdf79025133c00d6ad882d1c4d98dd PGP signature: -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEGk6LcnfELlPbqce5vKow6pwNV2MFAltN0GUACgkQvKow6pwN V2PjFwgAo2LxWP6T3A77eP6DE6itgUjOOj69WZrbybVu8ENwzhxb1kNvpk5PGee9 vHUdGrivmOGDJO8EeZGvexK1LliwfJ7a1HnEAoL1ob7KKftorrPuO9tCOHIy45/W QsZnNePwbBBrsJLsfNYno3BotQKGgy+96i9HPaX2RlswFOgbdy86hLNv+XTcCKyL mrswo1s3lR/hj6bk1AoTtKgW+m76yG4s8PeNtAGF1Z92Sysnaa4aGCHtStxOTaMp VuMPm47NbdDOCk7cFm2z/CkzB8Pq0ShxtbiDwy39BC9MRmmjDM/YqOxzX8mVEpXZ ok5PCT1i616JRDxwRg1Z1lKnpluXeg== =sfGN -----END PGP SIGNATURE----- php-7.0.31.tar.xz SHA256 hash: 68f57b3f4587071fb54a620cb83a1cfb3f0bd4ee071e0ce3bf7046a5f2d2f3cf PGP signature: -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEGk6LcnfELlPbqce5vKow6pwNV2MFAltN0GUACgkQvKow6pwN V2PuqQf/fBX+ZKmKQeFz/EgsfzbSTqWOjJg00SzCBWdzy9HzfGi1hktV7O7iT9Ku 827SCyQ/yJSHQUS9SwpeDMnmGLsFs9JSSH0uBLTDrLRgoNJCZoA/j2R0JNoKaHFm 0+U1w45vjHlDkFV6BRua8oNdt72uUEQVXgu0wyMBAg3GVroyzden2uN5Qh6e/xsG YWqDxbjYbY+zBs1DIrr2h1y7EaHggKS07WCEtKBjH5hRb7VzMUdqIzKowOyuwzSd puSTRxbcizTYnwasWpC00P4AnUyjARFgn3t0GOHw4iz14I0qadD2PFzVD0rnw36U Zw5/PpL8cQja5d3FmpenYx7J7+utSQ== =f6w7 -----END PGP SIGNATURE----- 
Posted on Leave a comment

PHP 7.2.8 Released

Hi, The PHP development team announces the immediate availability of PHP 7.2.8. This is a security release which also contains several minor bug fixes. All PHP 7.2 users are encouraged to upgrade to this version. For source downloads of PHP 7.2.8 please visit our downloads page. Windows binaries can be found on the PHP for Windows site. The list of changes is recorded in the ChangeLog. Release Announcement: http://php.net/releases/7_2_8.php Downloads: http://www.php.net/downloads Windows downloads: http://windows.php.net/download Changelog: http://www.php.net/ChangeLog-7.php#7.2.8 Many thanks to all the contributors and supporters! Sara Golemon, Remi Collet php-7.2.8.tar.gz SHA256 hash: a0cb9bf2f78498fc090eb553df03cdacc198785dec0818efa7a1804c2b7a8722 PGP signature: -----BEGIN PGP SIGNATURE----- iQIcBAABAgAGBQJbTYcUAAoJENyf+NPuWvJ/mnkQAJyGPUoytbfHWt6ABS0MefF8 lJdcM29EkvDeFYTXj4sAU5Ikyu/+Jd+4mcnvSkUQA+XLOvfwUyt6/9IyyM+yj+e2 E9oZmBy28FnVTodvKUXz8y7OPYWA8jrG0db+SJv8EVD1pn0VywqxKOKZL4wuUGJm ySRQuu9hfKFTVSBdgPAkmpNAztDer6cA9dhE6MuEkH3k8MhCDUUPMzVO4HUfwQnX PP04E3wvGWHDWt45T9zdaqxpL4mVvuMhKDPctJrn9uaOBqYz8Zwp/WKgi23P5sbQ ps+YmH0WTIx02E8MpTgt9HQYx2aicfjrNxMR50yxleA6ihyO+32kmttDlakaJl1f hqa/RB+nYenF+RvgQasakLCwQxNSl/QUVcH43p+yX22iyKvvc6g25umsmnEYfEqF u42hlfNpaN1MMYmTjA66iC7/eIobsqxMt0U1FPQuK+22qIbAt4Dk7izh4MB3u2VY k2TZn32BcBFzAjLk7/b3xG/OsQ9/q6wNz3id44IKpUUOTq6stbQRQiXco8kNpZ5Z 5krOcmbyImiZvOH8YCRj1KX+x5M3uT3B5kmhKZY3t+4Ys64+imopabI+YqDnR8ZC 2wNvjAW1dGS2sc4MxSYUEFW1Nv75GhljfOn+lvr0TjcV3hrzRNENUd6cxXkrVwTS 5eqvgT6by81KV8F6Nvsu =WxLL -----END PGP SIGNATURE----- php-7.2.8.tar.bz2 SHA256 hash: 1f8068f520a60fff3db19be1b849f0c02a33a0fd8b34b7ae05556ef682187ee6 PGP signature: -----BEGIN PGP SIGNATURE----- iQIcBAABAgAGBQJbTYcYAAoJENyf+NPuWvJ/tMIP/33P7530lbNNibXKee2uneDr O5ZHvQRJlBZpF0yG5zEz8UR1hArw6Yo+no8sksuOVP48gHFFwdk30dT8fzBlNsMh 2an742UEVGijWSHRQlSObMp2PzqcsI1/1fLoBC+fMOp9/c0B+cse5agj0v1cNNJ5 6uV+G6tESyx7t3OXXj48LRDbigta+SvrZibuloL3qFXYL4cpiDJsm9PZWF7l8aVh E0ncu4oaYrGPxw9jYNJgebq83BHeGGhYq0wJ9kH7LNbUWfP8HTII3c/Rmwr017I5 rA8LzXRZDn8LpZPayJrzbAOeCb9RkGl+ACDHUFxA1IDHrhHvQb57ppnagsmUAfAb GVtN7LD4ZnEzuCHlBbXZDaWNuxVOVlxXEbl01kpYgvXrKVdsHfpdWDk4N5X7T7+D bGDm+upxMZw07MJUjCLxhQBPovgqHTczl/iKuN358/YFbZTDOA8plydv5gQoVQ0a kva75VcJGyrxM1uQAKKFvVnTuQvaMY0Z3ra7cLE9oN26Z6lAsfeGBKOQAqytebE+ +9jREhRCvpew8EcKahgUl/w9DAqWHzFMJWnLTlbL68/arkUnYZVAUwHUXwsKl+oy 6Mx4pCGqs4XM/2y72/AdDcX9KXAAyCzpmt7FLj9TUMnZaQdoav4Iev0Qv64XO2aa F2VMusDce2SGtQ4HYULr =vXS7 -----END PGP SIGNATURE----- php-7.2.8.tar.xz SHA256 hash: 53ba0708be8a7db44256e3ae9fcecc91b811e5b5119e6080c951ffe7910ffb0f PGP signature: -----BEGIN PGP SIGNATURE----- iQIcBAABAgAGBQJbTYcaAAoJENyf+NPuWvJ/Q2wP/Raylawjhnw+E8iuwCyPbNni PmudNHfrWz9JKpMPnt/Q3ULDT2UR40Lpr78lL0KKC6je0CRCp/ajiB64L6DVzOQu dhetrSr0BqM3mwCEme2qfCx+Qme8czXUdVaze6s5LoOrdLkdJrUB+CLWbCzIijl4 6bdLVcwQ49Dc0kGR8VUnEKwYQWmjb4NIMe+O+DQxynThvNqEhgLTfVuLKgfl/q/V 581+oDtWZfPJmwQa8t8eT9J4/bq638hKpUzFXAAFF5edT3HAdySkPAEA8lqTrcik R3jB5fwMo2aqP4KPERyuY4g6Lpso4sx088AY1PiEO7BEYfJ8Zec3rpht4xMbfLfq GQ47BoMRH3eOxrKWPDdQ47GnDWxTeJroJ5WEbkVu8q7EdNwOaW8AyfyT5drMAkI7 3wiG2ptdFoaPFF0J3S//fXCvS5zooDhyQhqYD0WaYYPXbAuY6rePsdo/JtTZv2KV 1DW8PWW6W0eyKZItsPzwoclJ0maPEYjSvEVs+mSjpmPTxF7d9e+Im1kBNOA1xzXS H4TxHHgzB00Ljxc8DTngQypLYWG9Gf+wO5UAare7ChhB6dSef+2aA9dRxRQVn2js CvGnRkF7bvIqkUWIWomzCbMFweQafYq0kzqZMkClcpKK0ptvIEFj5r3C8xNC90cJ 37wKYiV63RHaPnnxd72/ =qac7 -----END PGP SIGNATURE-----
Posted on Leave a comment

Razor Improvements – Feedback Wanted

In recent releases of Visual Studio 2017, there has been a great focus on improving the experience of working with Razor files (*.cshtml). The improvements were aimed at addressing the most pressing customer-facing issues and included changes from formatting and IntelliSense to general performance and reliability. Now that the fixes and enhancements have been publicly available for a few months, we hope you’ve been having a much-improved experience with the Razor editor.

Please let us know how we’re doing by taking a short, two-minute survey. Also, feel free to leave relevant feedback in the comments section below.

If you haven’t already downloaded the latest version, update your copy of Visual Studio 2017 through the Visual Studio Installer, or follow the links to download the installer from the Visual Studio website.

Razor editor in Visual Studio IDE

We know that despite our improvements, Razor editing isn’t perfect yet, so if you run into issues please file a report using the Visual Studio feedback tool. We review this feedback frequently and will continue to fix issues that are identified.

To launch the feedback tool, choose “Report a Problem…” under the Help->Send Feedback menu. When filing a report, please provide as much of your Razor file as you can share, with a description of what happened versus what you expected. (Sample code and screenshots are very helpful!)

Report a Problem menu item

Thanks for your interest in Web Development in Visual Studio.
Happy coding!

Justin Clareburt, Senior Program Manager, Visual Studio

Justin Clareburt (justcla) Profile Pic Justin Clareburt is the Web Tools PM on the Visual Studio team. He has over 20 years of Software Engineering experience and brings to the team his expert knowledge of IDEs and a passion for creating the ultimate development experience.

Follow Justin on Twitter @justcla78

Posted on Leave a comment

Workaround for Bower Version Deprecation

As of June 25, the version of Bower shipped with Visual Studio was deprecated, resulting in Bower operations failing when run in Visual Studio. If you use Bower, you will see an error something like:

EINVRES Request to https://bower.herokuapp.com/packages/bootstrap failed with 502

This will be fixed in Visual Studio 15.8. In the meantime, you can work around the issue by using a new version of Bower or by adding some configuration to each Bower project.

The Issue

Some time, ago Bower switched their primary registry feed but continued to support both. On June 25th, they turned off the older feed, which the copy in Visual Studio tries to use by default.

The Fix

There are two options to fix this issue:

  1. Update the configuration for each Bower project to explicitly use the new registry: https://reigstry.bower.io
  2. Manually install a newer version of Bower and configure Visual Studio to use it.

Workaround 1: Define the new registry entry in the project’s Bower config file (.bowerrc)

Add a .bowerrc file to the project (or modify the existing .bowerrc) with the following content:

{
 "registry": "https://registry.bower.io"
}

With the registry property defined in a .bowerrc file in the project root, Bower operations should run successfully on the older versions of Bower that shipped with Visual Studio 2015 and Visual Studio 2017.

Workaround 2: Configure Visual Studio to point to use a newer version of Bower

An alternative solution is to configure Visual Studio use to a newer version of Bower that you have installed as a global tool on your machine. (For instructions on how to install Bower, refer to the guidance on the Bower website.) If you have installed Bower via npm, then the path to the bower tools will be contained in the system $(PATH) variable. It might look something like this: C:\Users\[username]\AppData\Roaming\npm. If you make this path available to Visual Studio via the External Web Tools options page, then Visual Studio will be able to find and use the newer version.

To configure Visual Studio to use the globally installed Bower tools:

  1. Inside Visual Studio, open Tools->Options.
  2. Navigate to the External Web Tools options page (under Projects and Solutions->Web Package Management).
  3. Select the “$(PATH)” item in the Locations of external tools list box.
  4. Repeatedly press the up-arrow button in the top right corner of the Options dialog until the $(PATH) item is at the top of the list.
  5. Press OK to confirm the change.

Configure External Web Tools Path
Ordered this way, when Visual Studio is searching for Bower tools, it will search your system path first and should find and use the version you installed, rather than the older version that ships with Visual Studio in the $(VSINSTALLDIR)\Web\External directory.

Note: This change affects path resolution for all external tools. So, if you have Grunt, Gulp, npm or any other external tools on the system path, those tools will be used in preference to any other versions that shipped with VS. If you only want to change the path for Bower, leave the system path where it is and add a new entry at the top of the list that points to the instance of Bower installed locally. It might look something like this: C:\Users\[username]\AppData\Roaming\npm\node_modules\bower\bin

We trust this will solve any issues related to the recent outage of the older bower registry. If you have any questions or comments, please leave them below.

Happy coding!

Justin Clareburt, Senior Program Manager, Visual Studio

Justin Clareburt (justcla) Profile Pic Justin Clareburt is the Web Tools PM on the Visual Studio team. He has over 20 years of Software Engineering experience and brings to the team his expert knowledge of IDEs and a passion for creating the ultimate development experience.

Follow Justin on Twitter @justcla78

Posted on Leave a comment

PHP 7.3.0 alpha 1

Hi all! PHP team is glad to announce the release of the first PHP 7.3.0 pre-release version, PHP 7.3.0 Alpha 1. This starts the PHP 7.3 release cycle, the rough outline of which is at: https://wiki.php.net/todo/php73 The source code can be downloaded from: https://downloads.php.net/~stas/ Please carefully test this version and report any issues found in the bug reporting system at http://bugs.php.net Please DO NOT use this version in production, it is an early test version. The next release would be Alpha 2, planned for June 21. The signatures for the release can be found at: https://gist.github.com/smalyshev/b0994d4dd138007237911429702ee040 or below: php-7.3.0alpha1.tar.gz SHA256 hash: bf3d089d876ac817aecd6afca7ef801cda5c809d4954871e8e6be38bea656f2c PGP signature: -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iF4EABEIAAYFAlsYI5EACgkQL3lWvF2gS13VYQD8CRnpb3777zrkHN9NAgCjv9xX z4jBKIT7s4bxKpnlqh8A/jyhy9Ru6MoZkUwZWgE4FOTesW4Q50G1NCEuotLbTwOa =87pc -----END PGP SIGNATURE----- php-7.3.0alpha1.tar.bz2 SHA256 hash: 8e27df8cf9db49cd2b56fa545b962e8f9ff31889c5429f77b4cf7d94ddab5a09 PGP signature: -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iF4EABEIAAYFAlsYI5sACgkQL3lWvF2gS13hZwEAkNyCRGLkdyWcEH9RgU7Y57+o FBYHNCvfHRnehyJEoiUA/3oUmXbevgVyIGnsrWnZ+LKeoroRJZ9ny5zT2Mo0AThL =N+jd -----END PGP SIGNATURE----- php-7.3.0alpha1.tar.xz SHA256 hash: a229d0bf48a3f91d1751ec859473abc70e7fd0f6befc2dc6578b3a128bd0e025 PGP signature: -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iF4EABEIAAYFAlsYI6MACgkQL3lWvF2gS12/XQD+NmLWvxAaTix94G8M80WoEULg 5EEnnuBCzOyr/PsudFEBAIRZ5wYMGqDma35LeZQ6rmCMJX0mPnYoqxL/kK3GdeyG =PQW8 -----END PGP SIGNATURE----- Thanks, Your friendly neighborhood PHP 7.3 RMs
Posted on Leave a comment

A Penny Saved is a Ton of Serverless Compute Earned

Scott Guthrie recently shared one of my favorite anecdotes on his Azure Red Shirt Tour. A Microsoft customer regularly invokes 1 billion (yes, that’s with a “B”) Azure Functions per day. The customer reached out to support after the first month thinking there was a bug in the billing system, only to find out that the $72 was in fact correct. How is that possible? Azure Functions is a serverless compute platform that allows you to focus on code that only executes when triggered by events, and you only pay for CPU time and memory used during execution (versus a traditional web server where you are paying a fee even if your app is idle). This is called micro-billing, and is one key reason serverless computing is so powerful.

Curious about Azure Functions? Follow the link https://aka.ms/go-funcs to get up and running with your first function in minutes.

Scott Guthrie Red Shirt

Scott Guthrie on the Azure Red Shirt Tour

In fact, micro-billing is so important, it’s one of three rules I use to verify if a service is serverless. There is not an official set of rules and there is no standard for serverless. The closest thing to a standard is the whitepaper published by the Cloud Native Computing Foundation titled CNCF WG-Serverless Whitepaper v1.0 (PDF). The paper describes serverless computing as “building and running applications that do not require server management.” The paper continues to state they are “executed, scaled, and billed in response to the exact demand needed at the moment.”

It’s easy to label almost everything serverless, but there is a difference between managed and serverless. A managed service takes care of responsibilities for you, such as standing up a website or hosting a Docker container. Serverless is a managed service but requires a bit more. Here is Jeremy’s Serverless Rules.

  1. The service should be capable of running entirely in the cloud. Running locally is fine and often preferred for developing, testing, and debugging, but ultimately it should end up in the cloud.
  2. You don’t have to configure a virtual machine or cluster. Docker is great, but containers require a Docker host to run. That host typically means setting up a VM and, for resiliency and scale, using an orchestrator like Kubernetes to scale the solution. There are also services like Azure Web Apps that provide a fully managed experience for running web apps and containers, but I don’t consider them serverless because they break the next rule.
  3. You only pay for active invocations and never for idle time. This rule is important, and the essence of micro-billing. ACI is a great way to run a container, but I pay for it even when it’s not being used. A function, on the other hand, only bills when it’s called.

These rules are why I stopped calling managed databases “serverless.” So, what, then, does qualify as serverless?

The Azure serverless platform includes Azure Functions, Logic Apps, and Event Grid. In this post, we’ll take a closer look at Azure Functions.

Azure Functions

Azure Functions allows you to write code that is executed based on an event, or trigger. Triggers may include an HTTP request, a timer, a message in a queue, or any other number of important events. The code is passed details of the trigger but can also access bindings that make it easier to connect to resources like databases and storage. The serverless Azure Functions model is based on two parameters: invocations and gigabyte seconds.

Invocations are the number of times the function is invoked based on its trigger. Gigabyte seconds is a function of memory usage. Image a graph that shows time on the x-axis and memory consumption on the y-axis. Plot the memory usage of your function over time. Gigabyte seconds represent the area under the curve.

Let’s assume you have a microservice that is called every minute and takes one second to scan and aggregate data. It uses a steady 128 megabytes of memory during the run. Using the Azure Pricing Calculator, you’ll find that the cost is free. That’s because the first 400,000 Gigabyte seconds and 1 million invocations are free every month. Running every second (there are 2,628,000 seconds in a month) with double memory (256 megabytes), the entire monthly cost is estimated at $4.51.

Azure Functions pricing

Pricing calculator for Azure Functions

Recently I tweeted about my own experience with serverless cost (or lack thereof). I wrote a link-shortening tool. It uses a function to take long URLs and turn them into a shorter code I can easily share. I also have a function that takes the short code and performs the redirect, then stores the data in a queue. Another microservice processes items in the queue and stores metadata that I can analyze for later. I have tens of thousands of invocations per month and my total cost is less than a dollar.

Link shortener stats

A tweet about cost of running serverless code in Azure

Do I have your attention?

In future posts I will explore the cost model for Logic Apps and Event Grid. In the meantime…

Learn about and get started with your first Azure Function by following this link: https://aka.ms/go-funcs

Posted on Leave a comment

PHP 5.6.36 is available

 Hello! The PHP development team announces the immediate availability of PHP 5.6.36. This is a security release. Several security bugs have been fixed in this release. All PHP 5.6 users are encouraged to upgrade to this version. For source downloads of PHP 5.6.36 please visit our downloads page: http://www.php.net/downloads.php Windows binaries can be found on http://windows.php.net/download/. The list of changes is recorded in the ChangeLog: http://www.php.net/ChangeLog-5.php#5.6.36 To verify the downloads, you can use the following information: php-5.6.36.tar.bz2 SHA256 hash: 626a0e3f5d8a0e686a2b930f0dd3a0601fe3dcb5e43dd0e8c3fab631e64e172a PGP signature: -----BEGIN PGP SIGNATURE----- iQEcBAABAgAGBQJa37ZtAAoJEMK/C8Qzz8iz8XQIAIhmNbsUrGxGKoyP37zzVxby 7zTYsRfZt2sOw+tLaBj15co95ncc86UATph6stDWyVaVp+CNlLF1Sh0TpDJOuiBO HrUWmMrOM7R4gaI2P22HD7d+zvZJLzgwtkaQ6+jrt2qhr5wPqBky3B321FMREnYA FLq13pb2hHSCLfeuYKZe2+KBouOmDFCi0+VKy8PdhHYAbMbbMFHGaVMEWwbr8Ulv oqozMa4STTmMpzdOc/6rMSFcQ01dndTQGuq3AelHtwkb7rus0I11S4CrwsEsV24F 6RIOJ7ORcNDIxCe/xF+mPOE2rvJTNbQxinrGEFduNN8NPP/6RsZ6ZfCIiA6hrxs= =rtkh -----END PGP SIGNATURE----- php-5.6.36.tar.gz SHA256 hash: 06086a8b6a9964ef8009c4d9176b4eeb0c564ea39c1213f015e24f3466d2d69f PGP signature: -----BEGIN PGP SIGNATURE----- iQEcBAABAgAGBQJa37ZyAAoJEMK/C8Qzz8izIYYH/18ltAzkrqLP+5m0MPZKJNH8 oISnKo4dB6i6PdSl65Pw6EqfgA8sEU6NGztSi82bysPMm9pvZn7hv1zhOISaqsUP GeUCcq+5poN/saymlmsjtF7cB/RyhiMKBDJ9yQkIuLR8dxcaY4YkwKx6lNKjYme5 k7TlnQc4YVFuukDZhLWYfvEJDyrKtYNCnXDpfcxIFiV9oqYWzSvR8oOoxkDJE5Qu q/eSoXUFeiXJLp4DL/38ph+z5+YhtjqDMJN2sJ18PVFWHRHtOuvMsPm3dy4l49di oyBoA5PxLA7rAjy0evaig6CrJPOOFKv2Zjc+5vB9bXFjKG8OR1Tbk6N3BFaNrHk= =6vkh -----END PGP SIGNATURE----- php-5.6.36.tar.xz SHA256 hash: 18f536bf548e909b4e980379d0c4e56d024b2b1eb1c9768fd169360491f1d6dd PGP signature: -----BEGIN PGP SIGNATURE----- iQEcBAABAgAGBQJa37Z3AAoJEMK/C8Qzz8izUa8IAJyMUOUk2jpYEg9+xarMFLYE tzt703TMjq3cIIyt9ds1hNU64MBC/y+Pzg5RTQAkG2XD88pwN5B3NwUp2KAgbXsQ TKtw+ymMJ/JFk6X4qh0Xx8R4MT8CTU3ZoUMY5WBVa3CbFy9PFMhMrJK6KnM+ATcJ 6cV2jE0Ca5c5ENWgkfNmPlSMjCni/dzPRrfBySbJpRuDbNkfY3AGngr2E1k/WKR7 VwgVIcdGgnJMf3x2NIxokr2gQcShhY7SE5hqflsG7099yIel51pSOxoGuSWOfq4j mBx0bLB39uyUm69HasZR518fgpZJOyE3R9iDsF1itaWbfG66/1h02HNJKjD9FHU= =cf+7 -----END PGP SIGNATURE----- Julien Pauli & Ferenc Kovacs