Quantcast
Channel: Visual Studio Blog
Viewing all 1076 articles
Browse latest View live

Installing the Unreal Engine in Visual Studio

$
0
0

As previously announced, Visual Studio has partnered with some of the most popular game engines to bring you an easy acquisition experience for game development tools.  Today we are pleased to confirm that we now provide the ability to acquire and install the Unreal Engine directly from the IDE. 

What is Unreal Engine?

The Unreal Engine is a cross-platform game engine targeting DirectX 11 and 12 for PC and Xbox, OpenGL for iOS, OS X and Android, and WebGL for the Web.  Console development on Xbox One and PlayStation 4 is also available on the Unreal Engine for registered developers of those platforms. Unreal Engine also supports virtual reality development targeting platforms including Oculus, PlayStation VR, SteamVR and Gear VR.

Unreal Engine games can be programmed using C++ and Unreal’s visual scripting framework called Blueprints.  Visual Studio serves as a powerful code editor and debugger when using C++ for Unreal development. 

Unreal C++ code inside Visual StudioUnreal C++ code inside Visual Studio

Visual scripting with BlueprintsVisual scripting with Blueprints

Getting Started

From Visual Studio you can open up the new project dialog using the FileàNew Project option and navigate to the installed templates, under which there will be a Game folder.  Inside you will see the options that Visual Studio currently provides for creating a game, which now includes Unreal Engine. The Unreal Engine template will not appear if Unreal Engine is already installed on your machine.

Visual Studio template item to install Unreal Engine

Selecting this template will automatically launch a series of dialogs that will guide you through the Unreal Engine installation.

Unreal Engine installer

After selecting install, the Visual Studio installer will launch with the Unreal Engine checked.  Click the Next button and you will be presented with a link to the Unreal Engine license, where clicking Update verifies that you have read and accept those terms and continues with the rest of the installation.

Visual Studio install options for Unreal Engine

Gametime

One the installer has completed, the Unreal application will launch and you are now ready to start making games!

UI of the Unreal Engine application

For more information on Unreal development, check out the following resources:

Getting Visual Studio Setup

Unreal Development Docs

Cheers,

The Visual Studio Team @ Microsoft

Adam Welch

Adam Welch, Program Manager, Visual Studio Team

Adam joined Microsoft in 2012 after graduating college, fueled by his passion for software development and game design. He has worked on the Visual C++ debugging and diagnostic tools, including the native memory profiler, and more recently began focusing on game development tools for Visual Studio.


Unit Testing Apache Cordova Apps with Visual Studio, Part 1

$
0
0

See Part 2 of this series.

Great apps—like great artists, actors, and athletes—are great performers. Human beings validate and continually improve their performances through extensive training, practice, rehearsals, and after-the-fact reviews. We achieve these same ends in software development through many levels of rigorous testing—or continuous validation—across the entire app lifecycle.

Chances are you’ve heard about unit testing, but you might not be clear on what it is, exactly, and how it fits into a cross-platform app project build with Apache Cordova. In the documentation for the Visual Studio Tools for Apache Cordova, we’ve recently added a whole section Author & run tests to explore the details of unit testing with Cordova apps through a series of comprehensive examples.

In this two-part post I’ll give a shorter version of those walkthroughs to familiarize you with the process. Part 1 here provides background on unit testing and a basic example with Cordova and Visual Studio. Part 2 will delve a little deeper into the subject of test-driven development and debugging unit tests.

 

Unit testing vs. other forms of testing

Unit testing is unique from other forms of manual and automated testing in a number of ways:

Unit Testing

Other Testing

Tests “units” of app code (classes, methods, properties, and functions) by calling/using them directly.

Tests the built app that’s been deployed to emulators or tests device through its user interface.

Is aware of how the app code is written (“white box testing”)

Is not aware of how the app was written (“black box testing”)

Tests are run on development and build machines via a test runner (for example, an independent JavaScript runtime like Node.js).

Tests are run on emulators or physical devices.

Tests are themselves pieces of code (typically written in the same language as the app code, e.g. JavaScript)

Tests are scripts (written manually or generated by a recorder) or are simply a set of steps that a tester performs manually.

Occurs early in the dev cycle, alongside coding or even before coding begins (test-driven development).

Occurs after a successful build of the app.

Ideally run very quickly so they can be performed with each build, which helps to quickly catch regressions introduced with code changes.

Are not time-sensitive (depending on one’s release management process)

Failed tests invalidate builds or commits to version control repositories.

Failed tests invalidate steps in a release management process.

 

The following figure illustrates how most forms of app testing (left) differ from unit testing (right), and illustrates that unit tests are typically run outside the app platform itself.

 

Note: when you set out to do unit testing, focus wholly on the code that you write or modify. You need not test libraries or other code you’re importing into a project but not modifying, as the authors of those libraries should have already tested them. If tests are lacking for a library you want to use, the right place to do that work is in the library’s source repo, not in your project.

 

Unit testing environments for JavaScript and Apache Cordova

A unit testing environment consists of the three components: the runtime, a test framework, and a test runner. The following table describes these and gives some examples.

Component

Description

Examples for JavaScript

Runtime

Loads and executes code being tested outside the app. This can happen in a browser or a separate runtime sometimes referred to as a “headless browser.”

Browsers, or Node.js, PhantomJS, Chrome V8

Test framework

Defines how to write pieces of code that are specifically identified as “tests,” typically in the same language as the code being tested so they can share the same runtime, but this is not required.

Jasmine, QUnit, Mocha along with libraries like Chai and assert.js

Test runner

Executes tests defined by a supported framework within a supported runtime, and produces test reports.

Chutzpah (uses PhantomJS), Karma (uses a browser)

 

All of these relationships are illustrated below:

 

 

Unit testing is then a matter of invoking the test runner at appropriate times and viewing the reports. This can be done manually or as part of an automated build process, and the test runner might be invoked through the command line or through integration with the Visual Studio IDE.

Some test runners, like Chutzpah, have a Visual Studio test adapter that integrates the tool and its reporting into Visual Studio’s Test Explorer. Other test runners, like Karma, don’t have a test adapter but can still be integrated into Visual Studio’s Task Runner Explorer in conjunction with tools like Grunt and gulp. Both options are covered in the documentation; for Karma and gulp, see Basic unit testing and Test Apache Cordova apps with Karma and Jasmine.

 

Unit testing in action

To better understand the mechanics of unit testing, let’s now follow a piece of code and an associated unit test through the basic process with Chutzpah, QUnit (jQuery’s unit test framework), and Visual Studio.

The “unit”

First, assuming you have the Visual Studio Tools for Apache Cordova installed, create a new app project through File > New Project, selecting JavaScript > Apache Cordova Apps > Blank App. Then in the www/scripts folder create a file called normalize.js with the code below.

/** @description Converts JSON data that may contain Name and PersonalIdentifier
 *    properties to an object with the properties name (string) and id (positive
 *    integer up to 9999999999.
 * @param {string} jsonIn The JSON data to normalize.
 * @return {object} An object with name (string) and id (integer) properties,
 *    defaulting to "default" and 0, or null if the JSON is null or invalid.
 */
function normalizeData(jsonIn) {
}

This simple normalizeData function is the “unit” we’ll be testing, and we’ll leave it empty for the moment. Understand that this code is strictly part of the app’s functionality: it has nothing whatsoever to do with our choice of test framework or test runner.

The unit tests

Next, each unit test is a piece of code that validates a unit by:

  1. Calling it with specific inputs, and,
  2. Checking the output against the expected value.

A unit test must follow the conventions of the test framework you’re using. Because we’re testing JavaScript code, it’s easiest to use one of the many JavaScript test frameworks available to us. For this example, we’ll use the one called Jasmine. It enjoys built-in support with the Chutzpah test runner that we’ll be using shortly, so we don’t need to install anything for Jasmine specifically.

For the unit tests, create a folder named test in the project, then create a file in that folder called normalize_tests.js with the following contents:

// First argument to "describe" is the name of this group of tests
describe("normalizeData tests", function () {
    // First argument to "it" is the name of the specific test
    it("accepts golden path data", function () {
        // Use the unit being tested as necessary
        var json = '{"Name": "Maria", "PersonalIdentifier": 2111858}';
        var norm = normalizeData(json);

        // Check the results; "expect" is a Jasmine method.
        expect(norm.name).toEqual("Maria");
        expect(norm.id).toEqual(2111858);
    });
});

In Jasmine, you create a group of tests with its describe method, and each test is a call to a function named it, which ends up reading quite well with the description of the test itself. Within each test you use the unit code however you want, and then check results with Jasmine’s expect method that generates the appropriate pass/fail report output.

We have just one simple test to start with here, but notice how it’s specific: it calls the unit under test with one set of inputs and gives an exact name/description for the test with those inputs. This follows the best practice of isolating each unit test to an individual test case, creating a 1:1 mapping between the name of the test, as it appears in reports, and the exact test case (that is, the arguments used in the test). When the test runner reports a failure, then, you know exactly where to look in your code and can easily step through that one test in the debugger to isolate the failure. This saves you time in the end, because if you combine tests, you’ll have to debug the whole set to find the one that failed, and you’ll likely end up separating all the tests anyway.

 

The test runner

With unit code and at least one unit test in place, we can now run the tests with the Chutzpah test runner. To install it, go to Tools > Extensions and Updates… in Visual Studio, select Online, then search for and install the “Chutzpah Test Adapter” (you’ll be prompted to restart Visual Studio):

 

To tell Chutzpah about the files it should work with, create a Chutzpah.json file in the project’s root folder with the following contents:

{
  "References": [
    { "Path": "www/scripts/js/normalize.js" }
  ],

  "Tests": [
      { "Path": "test/normalize_tests.js" }
  ]
}

The “References” section clearly identifies the code to test and the “Tests” section identifies the unit test files. You’d obviously list more code and test files as you add them to a project.

Now select Test > Windows > Test Explorer and you should see the available tests listed there:

 

Note: if nothing appears, there are likely syntax errors in your test files which prevent Chutzpah from finding those tests.

Click Run All to build the project, run the tests, and see the results. Because we don’t have any implementation in normalizeData, the test should fail:

 

This verifies that you have the mechanics of using Chutzpah working within Visual Studio.

If you’d like to make the test pass, implement normalizeData so it at least handles expected inputs and run the test again:

function normalizeData(jsonIn) {
    data = JSON.parse(jsonIn);
    return {
        name: data.Name,
        id: Number(data.PersonalIdentifier)
    };
}

Of course, this code can’t handle anything other than perfect JSON, so there’s definitely room for improvement! We’ll pick up that story in Part 2 where we’ll talk about test-driven development and debugging unit tests.

In the meantime, I’d love to hear how you work with unit testing in Cordova apps, how you’re working with UI testing (both manual and automated), and how we can further improve our support through the Visual Studio Tools for Apache Cordova. Add a comment below, drop me a line at kraigb (at) microsoft.com, or submit suggestions via http://visualstudio.uservoice.com/.

Happy testing!

See Part 2 of this series.

clip_image010

Kraig Brockschmidt, Senior Content Developer, Visual Studio

@kraigbro

Kraig has been around Microsoft since 1988, working in roles that always have to do with helping developers write great software. Currently he’s focused on developing content for cross-platform mobile app development with both Xamarin and Cordova. He writes for MSDN Magazine, is the author of Programming Windows Store Apps with HTML, CSS and JavaScript (two editions) and Inside OLE (two editions, if you remember those) from Microsoft Press, occasionally blogs on kraigbrockschmidt.com, and can be found lurking around a variety of developer conferences.

Unit Testing Apache Cordova Apps with Visual Studio, Part 2

$
0
0

Part 1 of this post provided some background on unit testing with a basic example in Visual Studio for an app written with Apache Cordova. In this post we’ll make many improvements to that example using the process of test-driven development, which helps you separate the process of thinking about how to challenge a unit of code to fail from the process of coding that unit to make it not fail! We’ll also discuss a little about debugging unit tests.

Again, these two posts are a shorter version of walkthroughs that we’ve recently added to the documentation for the Visual Studio Tools for Apache Cordova, in the section Author & run tests.

 

Test-driven development

It should be obvious that having one test for an empty (or overly simplistic) implementation of normalizeData is woefully inadequate. A robust normalizeData needs to handle all sorts of bad JSON that would cause utility functions like JSON.parse and/or property dereferences to fail. And of course we need to have tests that exercise all the data variations we can think of.

Question is, where to start? Write code, write tests, or go back and forth between the two? You’ve probably done plenty of the latter: write some better code into normalizeData, then write some tests, examine cases that fail, then write more code, write more tests for cases you haven’t covered yet, correct the code again, and so on. Although this is manageable, it forces you to switch back and forth between thinking about code and thinking about data, and switching between trying to make the code work properly and thinking up ways to make it fail. These really are two different mental processes!

This is where the approach of test-driven development shows its value. To fully exercise any piece of unit code, you eventually have to think through all the necessary input variations. Test-driven development does this thinking up front, which is very efficient because once you think of a few tests cases, you can quickly see additional ones. For example, if you think to include an object inside a piece of JSON, you’ll naturally think to include an array as well. If you think to include an integer where the unit code might expect a string, it’s natural to also try a string where it expects an integer.

With the normalizeData function, I found it took perhaps 15 minutes to think through a strong set of test inputs with different challenges to JSON.parse, challenges to assumptions about the structure of valid JSON, and challenges to assumptions about data types. Here’s that list:

'{"Name": "Maria", "PersonalIdentifier": 2111858}'
null
''
'blahblahblah'
'{{}'
'{{[]}}}'
'document.location="malware.site.com"'
'drop database users'
'{"Name": "Maria"}'
'{"PersonalIdentifier": 2111858}'
'{}'
'{"name": "Maria", "personalIdentifier": 2111858}'
'{"nm": "Maria", "pid": 2111858}'
'{"Name": "Maria", "PersonalIdentifier": 2111858, "Other1": 123, "Other2": "foobar"}'
'{"Name": "Maria", "PersonalIdentifier": "2111858"}'
'{"Name": "Maria", "PersonalIdentifier": -1}'
'{"Name": "Maria", "PersonalIdentifier": 123456789123456789123456789123456789}'
'{"Name": , "PersonalIdentifier": 2111858}'
'{"Name": 12345, "PersonalIdentifier": 2111858}'
'{"Name": {"First": "Maria"}, "PersonalIdentifier": 2111858}'
'{"Name": "Maria", "PersonalIdentifier": {"id": 2111858}}'
'{"Name": {"First": "Maria"}, "PersonalIdentifier": {"id": 2111858}}'
'{"Name": ["Maria"], "PersonalIdentifier": 2111858}'
'{"Name": "Maria", "PersonalIdentifier": [2111858]}'
'{"Name": ["Maria"], "PersonalIdentifier": [2111858]}'
'{"Name": "Maria", "PersonalIdentifier": "002111858"}'
'{"Name": "Maria", "PersonalIdentifier": 002111858}'

Again, once you get thinking about input variations, one test case naturally leads to another. And once you’ve worked out JSON variations for one unit test, you’ve essentially created a reusable asset for any other function that takes JSON, in whatever project.

With the input list in hand, it’s now a simple matter—with a lot of copy and paste!—to wrap the necessary test structure around each set of inputs. For example:

it('accepts golden path data', function () {
    var json = '{"Name": "Maria", "PersonalIdentifier": 2111858}';
    var norm = normalizeData(json);
    expect(norm.name).toEqual("Maria");
    expect(norm.id).toEqual(2111858);
});

it ('rejects non-JSON string', function () {
    var json = 'blahblahblah';
    var norm = normalizeData(json);
    expect(norm).toEqual(null);
 });

it('accepts PersonalIdentifier only, name defaults', function () {
    var json = '{"PersonalIdentifier": 2111858}';
    var norm = normalizeData(json);
    expect(norm.name).toEqual("default"); //Default
    expect(norm.id).toEqual(2111858);
});

it('ignores extra fields', function () {
    var json = '{"Name": "Maria", "PersonalIdentifier": 2111858, "Other1": 123, "Other2": "foobar"}';
    var norm = normalizeData(json);
    expect(norm.name).toEqual("Maria");
    expect(norm.id).toEqual(2111858);
});

it('truncates excessively long Name', function () {
    //Create a string longer than 255 characters
    var name = "";
    for (var i = 0; i < 30; i++) {
        name += "aaaaaaaaaa" + i;
    }

    var json = '{"Name": "' + name + '", "PersonalIdentifier": 2111858}';
    var norm = normalizeData(json);
    equal(norm.Name).toEqual(name.substring(0, 255));
    equal(norm.Name.length).toEqual(255);
    expect(norm.id).toEqual(2111858);
});

it('rejects object Name and PersonalIdentifier', function () {
    var json = '{"Name": {"First": "Maria"}, "PersonalIdentifier": {"id": 2111858}}';
    var norm = normalizeData(json);
    expect(norm).toEqual(null);
});

Note that the test names (the first argument to it) are what appear in UI like Test Explorer, so they should always identify what’s being testing and the basic nature of the test (e.g. “rejects” or “accepts”). Also, it’s certainly possible to put inputs and expected results into an array and iterate that collection instead of writing each test individually. I’ve just left everything explicit here.

The point here is that by first spending something like 30 minutes of focused work on input variations and wrapping them in unit tests, you’re now entirely free to focus on writing the code without having to wonder (or worry!) whether you’re really handling all the possible inputs.

In fact, if you run all these tests against an initially empty implementation of a function like normalizeData, many or most of them will clearly fail. But that just means that the list of failed tests is your to-do list for coding, mapping exactly to the subset of input cases that the function doesn’t yet handle properly. You improve the code, then, to pass more and more tests. When the function passes all the tests, you can be completely confident that it can handle all the possibilities it should. For a full walkthrough, which includes the completed implementation of normalizeData, see Improving the unit tests: an introduction to test-driven development in the documentation.

Test-driven development, in short, cleanly separates the task of coming up with input cases from the task of writing the code to handle those cases. Ultimately, if you’re going to do a really good job testing your code, you’ll have to separate these tasks one way or another. By acknowledging this up front, test-driven development can result in more robust code earlier in the development process, which can reduce your overall costs.

 

Debugging tests and runtime variances

One of the unit tests shown in the previous section is buggy. Do you see which one? I thought I’d written a complete implementation of normalizeData, which included code to handle the 'truncates excessively long Name' test case, but that case was still failing and I couldn’t see the problem right away.

Fortunately, Visual Studio gives you the ability to debug unit tests just like you can debug any other kind of code, with the ability to set breakpoints, examine variables, and step through the test code. Unit test code is still code, after all, and just a prone to bugs!

Setting breakpoints in the Visual Studio editor isn’t enough, however. Running tests through Test Explorer doesn’t pick up those breakpoints because a test runner like Chutzpah is spawning separate PhantomJS processes to load and execute all the JavaScript, but the Visual Studio IDE doesn’t have debug hooks into that engine.

You have instead use the Test > Debug > Run menu, where you’ll find options for Selected Tests and All Tests. You can also right-click a failed test and select Debug Selected Tests. Any of these commands will, for JavaScript, instruct the test runner to execute code in a browser, to which Visual Studio can attach the debugger. Reports from the test framework will also appear in the browser.

Gotcha alert! The Test > Debug > Run > All Tests and Test Explorer > Run All commands automatically save any files that you’ve modified in the project. However, commands that run individuals tests, do not save changed files, which can lead to some confusion when an expected change isn’t picked up. So be sure to save prior to running individual tests.

In the debugger, I was able to see that my unit test mistakenly tries to dereference norm.Name rather than norm.name:

After this fix I had just a single remaining test to satisfy, one that tested having a leading zero on an integer value in the JSON. I wasn’t sure why it was failing, so I started the debugger for that test as well. But in the debugger, the test passed! What was going on?

Turns out that I found a small difference between the implementation of JSON.parse in the PhantomJS runtime, which was used when running tests outside the debugger and throws an exception with the leading zero, and the Internet Explorer runtime, which was used during debugging and is just fine with the leading zero. See the topic Debugging unit tests in the documentation for that story!

What’s important to keep in mind here, is that you may find a few similar differences between the runtime used for unit testing and the platform runtime used when the app runs for real. For this reason it’s a good idea to occasionally run all your unit tests on each mobile platform. To do this, adding a special page to a debug build of your app that runs tests when you navigate there. In this case, the act of navigation serves as the test runner, and you’ll need to explicitly reference the test framework libraries so that they’re loaded for that page.

 

Closing

That wraps it up for parts 1 and 2 of this post, which is again a shorter version of content that we’ve published in the Author & run tests section of the documentation. There you’ll find more detailed walkthroughs, along with a discussion about using “mocks” to handle calls to platform APIs and other external dependencies that the unit testing runtime won’t have access to. Let us know what you think!

I’d also love to hear how you work with unit testing in Cordova apps, how you’re working with UI testing (both manual and automated), and how we can further improve our support through the Visual Studio Tools for Apache Cordova. Add a comment below, drop me a line at kraigb (at) microsoft.com, or submit suggestions via http://visualstudio.uservoice.com/.

Happy testing!

clip_image010

Kraig Brockschmidt, Senior Content Developer, Visual Studio

@kraigbro

Kraig has been around Microsoft since 1988, working in roles that always have to do with helping developers write great software. Currently he’s focused on developing content for cross-platform mobile app development with both Xamarin and Cordova. He writes for MSDN Magazine, is the author of Programming Windows Store Apps with HTML, CSS and JavaScript (two editions) and Inside OLE (two editions, if you remember those) from Microsoft Press, occasionally blogs on kraigbrockschmidt.com, and can be found lurking around a variety of developer conferences.

Visual Studio Tools for Apache Cordova Update 5

$
0
0

Welcome to the new year and a new Visual Studio Tools for Apache Cordova (TACO) update! We just released Update 5 of the tools for you—full details are in the release notes—and we’ve created a new developer blog that you can follow to keep up to date with tips, tricks, and articles from our development team.

New in Visual Studio TACO Update 5

In Visual Studio 2015, you should see a prompt to download and install the new Visual Studio TACO Update 5 release.

Visual Studio prompt to install TACO Update 5

The top changes in this release are:

  • CLI interop. If you switch between the command line and Visual Studio, your changes reflected in both development environments.
  • Node 5 / NPM 3 and Cordova 5.4.1 / 6 compatibility. Right now, NPM 3 does not work with Cordova versions 5.3.x and lower. In Update 5, if you are targeting a Cordova version older than 5.4.0 and you have NPM 3 or higher, we will fail your build and show you an error message with suggestions for fixing your build.
  • Over 50 bug fixes. These address issues such as supporting the iOS 6s simulator, various Ripple deployment matters, and support for MySQL.

Read more from our developers, or go to the release notes for Update 5.

Keeping in touch with you!

In addition to building out our tools, we’ve also been working on a few new ways to connect you with members of our team—to help you master the tools and move past issues blocking you from completing your projects.

New developer blog. We’ve just released a new Visual Studio TACO Developer Blog to which we’ll share out regular topics from our engineering team – including tips, tricks, and “behind the scenes” topics.

Visual Studio TACO Developer Blog

Cordova Tools Live Stream. We’re also continuing the Cordova Tools Live stream that we announced last November. In the months ahead, we’ll continue to have regular question and answer sessions with the community. We’ll also be expanding to include a regular set of interviews and topics of interest to Cordova developers at large. Finally, you’ll see us step up the video and audio quality dramatically with the help of our friends at Channel 9.

Cordova Tools Live

Visual Studio TACO Newsletter. In order to keep you updated on all the new samples, tutorials, and guides we are coming out with, we have started a Visual Studio TACO Newsletter with helpful tips on the topics we find you all are asking about. Sign up here and look for the first issue in late January!

 

Lina Zhong

Linda Zhong, Program Manager, Visual Studio Client Tools Team

Linda is new to the Tools for Apache Cordova team, but not new to the trials and tribulations of sad documentation. She spends her time thinking about how to make the VS Cordova user experience really rock!

Jordan Matthiesen

Jordan Matthiesen (@JMatthiesen)
Program Manager, Visual Studio Tools for Apache Cordova

Jordan works at Microsoft on JavaScript tooling for web and mobile application developers. He’s been a developer for over 18 years, and currently focuses on talking to as many awesome mobile developers as possible. When not working on dev tools, you’ll find him enjoying quality time with his wife, 4 kids, 1 dog, 1 cat, and a cup of coffee.

Top News from October-December 2015, Part 1

$
0
0

It’s been a few months since our last roll-up of top developer stories, so I’ll be catching up with the news from last fall in two posts. We’ll start here in Part 1 with Visual Studio, .NET, ASP.NET, languages, and a few other tools for good measure. Part 2 will cover a variety of topics including Connect(); //2015, Windows 10, cross-platform development,. Visual Studio Code, and a number of other goodies. So let’s get started.

Visual Studio Update 1: almost like clockwork, John Montgomery announced the CTP (October), RC (November), and RTM (December) releases of Visual Studio Update 1. Among the complete list of features and changes that you can find on the Update 1 RTM Release Notes, and a few of the top features are as follows:

  • The C# Interactive Window and the command-line C# REPL window. (The Interactive Window is the REPL window inside Visual Studio.) For a quick demonstration, watch Kasey Uhlenhuth’s video on Channel 9 (11m 41s).
  • Edit and Continue support for /BigObj in C++, brings this powerful debugging feature to Windows Store C++ projects.
  • Go To Implementation: right-click on an interface or abstract method definition and navigate to its implementation:

Go To Implementation features in Visual Studio 2015 Update 1

 

  • Pull requests in the Team Explorer window through the Pull Requests hub, which shows your requests and those from others. Visual Studio Update 1 also improves the Create Pull Request experience so you can publish branches and create pull requests in a single action.

Pull requests from Team Explorer Window in Visual Studio 2015 Update 1

 

Profiling, remote Linux debugging, and IntelliTest: there has been some advance in a number of tools with Visual Studio 2015 that are worth calling out separately. First is the ability to profile your CPU in the debugger, as explained by Nikhil Joglekar, that lets you watch the CPU utilization graph to see if there is any CPU-intensive code running as you set breakpoints and step through code. In November, Marc Goodner shared the release of the Visual Studio GDB Debugger extension that enables debugging remote Linux targets including IoT devices. Pretty cool stuff, which even works on a Linux VM running in Azure! You can also read Prakash Patel’s post on Remote Debugging for JavaScript. Another fun extension is the Breakpoint Generator Extension, which automatically scans the source code in the active solution, finds the public methods (which are typical entry points to the program), and puts a breakpoint and a configurable trace message to the beginning of each method. Also very cool! And lastly, perhaps the coolest of all for developers with Visual Studio Enterprise Edition, is IntelliTest for .NET, which, as Pratap Lakshman explains in this post, helps you generate a whole suite of unit tests with a high degree of code coverage at a fraction of cost. You can also see a video demo in IntelliTest on Channel9 (34m 45s). Of course, this means you’ll run low on excuses for not unit-testing your .NET code. J

IntelliTest for .NET

On the .NET front: The .NET Framework 4.6.1 announcement got plenty of attention with a variety of improvements, including some for WPF as explained also by Harikrishna Menon in his separate post. There’s also an interesting post by Omar Khudiera of Pangea Engineering called Why .NET? with some comparisons to Go and Java. Then we have the open-source, cross-platform .NET Core (now officially .NET Core 1.0) that is also gaining momentum, and the Introducing .NET Core video (7m 8s) by Richard Lander gives you the overview. .NET Core is also an integral component of Universal Windows apps in Windows 10, as explained in the short video .NET for UWP: CoreFx (3m 8s) by Lician Wischik. But that’s not all—because .NET Core can run on any platform, it’s also suitable for Linux, which means it can be used in Docker containers as well. Elton Stoneman explains this in Getting Started with .NET and Docker. With Docker, too, Adarsha Datta wrapped up a series on Docker: Containerize your Startup, the earlier parts of which we highlighted last summer.

Introducting .NET Core by Richard Lander

ASP.NET: You may have just read on the ASP.NET blog (or Scott Hanselman’s) that ASP.NET 5 is now officially called ASP.NET Core 1.0 to go along with .NET Core 1.0 and Entity Framework 1.0 (which was Entity Framework 7). The naming change underscores the fact that the former “ASP.NET 5” was not a replacement for ASP.NET 4.6 and that we’re really entering a new space with the “Core” releases—“a fork in the road” as Hanselman describes it. That said, you’ll still find quite a few entirely applicable resources on “ASP.NET 5” including Scott Hunter’s video, Introducing ASP.NET 5 and Web Tooling (14m 51s), Dan Wahlin’s longer discussion in Modern Web Development (48m 8s), and Abhinaba Basu’s post, Publishing an ASP.NET 5 Web Application to IIS locally. And of course, fun things continue to happen in ASP.NET 4.6, such as WebHooks, as Scott Hanselman covers in Introducing ASP.NET WebHooks Receivers – Webhooks made easy. He also has a great post on simulating a low bandwidth connection.

clip_image008

C#, C++, TypeScript, and JavaScript: to wrap up the top news for Part 1, we have some fun items to share where languages are concerned. First, you can get a look ahead to C# 7 with this video by Mads Torgersen (58m 15s). If you’re writing C++, you’ll probably enjoy the session Writing Good C++14 from CppCon2015 (1h 42m) by none other than the master himself, Bjarne Stroustrup! And if you want be on the cutting edge of some C++ developments, check out the C++ Experimental Editor Tools, which you can turn on and off in Visual Studio 2015 as explained by Gabriel Ha. Heading over to the land of JIT, now, Bill Ticehurst has a video on What’s New in TypeScript (12m 7s) and David Catuhe shares two posts on Using JavaScript frameworks from your C#/UWP application and JavaScript goes to Asynchronous City, in the latter of which he shares the developments on promises in ECMAScript 6. Oh, and did you catch the news in December that Microsoft Edge’s “Chakra” JavaScript engine went open source? The repository itself just opened up here in January.

Soma SomasegarFinally, on behalf of everyone who has enjoyed working with and for Soma Somasegar, we wish you a fond farewell as you wrapped up 27 years of service at Microsoft! To enjoy a look back through his career and all the changes that have taken place during that more than a quarter-century, check out Mary Jo Foley’s exit interview with Soma. In one response he says, “I am a strong believer in developer choice and meeting developers where they are. Microsoft has been all about building great tools and platforms and letting developers make the choice of what they want to use and when.” That legacy, I know, pervades the work we do in Microsoft’s Developer Division, and will persist long into the future.
Thank you, Soma!

 

clip_image011

Kraig Brockschmidt, Senior Content Developer, Visual Studio
@kraigbro

Kraig has been around Microsoft since 1988, working in roles that always have to do with helping developers write great software. Currently he’s focused on developing content for cross-platform mobile app development with both Xamarin and Cordova. He writes for MSDN Magazine, is the author of Programming Windows Store Apps with HTML, CSS and JavaScript (two editions) and Inside OLE (two editions, if you remember those) from Microsoft Press, occasionally blogs on kraigbrockschmidt.com, and can be found lurking around a variety of developer conferences.

Top News from October-December 2015, Part 2

$
0
0

In Part 1 of this post I shared news from the fall on Visual Studio, .NET, ASP.NET, and languages. Here I’ll conclude the roll-up with news around Connect(); //2015, cross-platform development,. Visual Studio Code, Windows 10, and a little more.

Connect(); //2015: Our second Connect(); event was, to my mind, even more impressive than the first. I say this not just for the news and announcements, as John Montgomery reviews in his post, but for the way that all the demos tied together into one story that really illustrated the comprehensive platforms and tools that Microsoft is now delivering. Those demos were all built around a full health and technology scenario called HealthClinic.biz, the story of which Erika Ehril Cabral shares in her post from December. If you haven’t read that post yet, don’t deprive yourself any longer, because it also includes specific links to the exact demo segments in the Connect(); //2015 videos! Better still, the whole scenario is on GitHub so you can benefit from the work and also make contributions. And for just a bit of fun, take half a minute (OK, 35 seconds!) to enjoy Scott Guthrie get’s ready for Connect(); //2015.

Scott Guthrie prepares for Connect(); //2015

Mobile and Cross-Platform Tools: work continues at a rapid pace on tools that help you develop mobile apps with Visual Studio. For Android directly, Marian Luparo talks all about Java debugging and language support in Visual Studio, and Mike James (on I Programmer) published a comparison between Visual Studio and Android Studio. The Visual Studio Emulator for Android team keeps delivering improvements too, and you can get the latest from John Kemnetz in his Connect(); //2015 video (5m 55s). Expanding to cross-platform tools for Windows, iOS, and Android, you can get an overview from Amanda Silver (3m 19s) and go into much more depth with Jeremy Foster, Varun Gupta, Ankit Asthana, and Jonathan Carter (54m 38s). In the latter you’ll hear about all the cross-platform tools including the Visual Studio Tools for Apache Cordova, Xamarin, Windows 10 UWP, and cross-platform C++. In this context, also check out Microsoft’s new Code Push service that enables Cordova and React Native developers to deploy mobile app updates directly to user devices, along with James Montemagno’s discussion on Xamarin.Forms 13m 4s) and the new Xamarin 4 release.

Java language support in Visual Studio

Windows 10 for Awesome Hardware: Windows 10 is certainly gaining momentum on a wide variety of systems, and Visual Studio clearly offers great tools for the Universal Windows Platform. What’s most fun to watch, though, is how Windows 10 is reaching onto new devices. Mark DeFalco and Nikola Metulev, for example, made a fun video on HoloLens + Lumia + Surface + Band + Windows 10 (24m 11s) that you can view on Channel 9. With the release of the Microsoft Band 2, there’s also an updated Band SDK that you can learn about from Maria Kang. And if you’re really just getting started, then try starting with Bob Tabor’s training series, Windows 10 development for absolute beginners. With dozens of episodes, you’ll learn everything you need!

Microsoft Band 2

Visual Studio Code: It’s quite enjoyable to see the evolution of this newest member of the Visual Studio family as it reaches many developers on non-Microsoft platforms. Sergiy Baydachnyy has been writing a whole series on Visual Studio Code for Mac developers, covering everything from installation and editor features to working with Git, deploying to Azure, and developing Cordova apps. I myself recently spend some time working exclusively in Visual Studio with Node.js, Express, MongoDB, and client-side AngularJS, and was impressed both by Code’s lightweight speed (it takes only a minute to install!) and its extensibility to support all kinds of different development scenarios. One key thing I learned: whenever you install a new package from npm, go right out and get the IntelliSense definitions via the tsd command. For web development too (and on a Mac), Robert Green shows you all the tricks in Visual Studio Code and Web Development (41m 52s).

Visual Studio Code on Mac OS X

 

U-SQL: The world of SQL is not necessarily where you expect to see new developments, but the introduction of U-SQL as a Big Data query language has attracted quite a bit of attention. Michael Rys first announced the language and its rationales in Introducing U-SQL – A Language that makes Big Data Processing Easy, and followed up with Writing and Using Custom Code in U-SQL. All this goes along with the public preview of the Azure Data Lake service, which is definitely work checking out if Big Data is on your radar.

And finally, for a bit of fun, developers of all sorts will appreciate Peter Wayner’s 9 bad programming habits we secretly love. I especially enjoyed the comments on goto because I did quite a bit of assembly programming early in my career where jump and branch instructions are just a way of life when you don’t have any higher-level concepts to work with. I imagine that some IoT developers working in assembly are thinking the same thing!

 

clip_image011[5]

Kraig Brockschmidt, Senior Content Developer, Visual Studio
@kraigbro

Kraig has been around Microsoft since 1988, working in roles that always have to do with helping developers write great software. Currently he’s focused on developing content for cross-platform mobile app development with both Xamarin and Cordova. He writes for MSDN Magazine, is the author of Programming Windows Store Apps with HTML, CSS and JavaScript (two editions) and Inside OLE (two editions, if you remember those) from Microsoft Press, occasionally blogs on kraigbrockschmidt.com, and can be found lurking around a variety of developer conferences.

Apache Cordova development lands on Visual Studio Code

$
0
0

Thousands of developers already use Visual Studio’s Tools for Apache Cordova—affectionately abbreviated as “TACO”—to build mobile apps for iOS, Android and Windows using a shared JavaScript codebase. Within the IDE, TACO provides everything you need to install and configure the native SDKs, preview your app, debug on emulators and devices, and even manage continuous integration/deployment via Visual Studio Team Services.

Today, we are pleased to announce new ways to build, debug and preview Cordova apps using your favorite light-weight text editor (it is your favorite, right?): VS Code and the Cordova Tools extension.

With this extension, you can debug hybrid apps, find Cordova-specific commands in the Command Palette, and use IntelliSense to browse objects, functions, and parameters. You can use it with both “stock” versions of the Apache Cordova framework and downstream frameworks like Ionic, Onsen, PhoneGap and SAP Fiori Mobile Client. Because they all use the same Cordova build systems and core runtime, the TACO extension is adaptable to the JavaScript framework of your choice.

In fact, you can even use Visual Studio Code on a project created with the full Visual Studio IDE. For example, imagine creating a Cordova project using Ionic templates with Visual Studio on a Windows machine, then opening it on an OS X or Linux machine using Visual Studio Code—making some edits—then continuing your work in the Visual Studio IDE. No matter which editor you choose, you get the full benefit of debugging, IntelliSense, and language support. How cool is that?

Debugging a Cordova app in Visual Studio Code

Visual Studio Code + Cordova Tools currently support debugging apps on emulators, simulators, and tethered devices for Android and iOS. If you ask for it (email or tweet us), Windows support will follow not too far behind. You can also attach the debugger to an app that is already running on a device; the debugger simply uses the application ID to locate the running instance.

How do I get it?

If you haven’t already, download and install Visual Studio Code for Mac, Windows or Linux from http://code.visualstudio.com. It’s under 50MB and on a decent network connection you’ll have it installed in under 2 minutes. Once that’s done, install the Cordova Tools extension directly from within the code editor. Simply invoke the Command Palette (Cmd+P on Mac, Ctrl+P on Windows), type “>ext install cordova”, and hit Enter.

Installing the Cordova Tools extension in Visual Studio Code

You guessed it…open source!

You can, of course, contribute to improving the extension further. The Cordova Tools extension is open source, so if you run into any issues or have suggestions for new features, please open an issue or better yet, make the change and send us a pull request.

And last but not the least, we have also made some improvements in our command line tools and extensions for continuous integration optimizing your inner and outer dev loops!

Send us your feedback

We invite you all to join in our journey to grow an active community of Cordova developers to build amazing apps using TACO. Tell us what you’d like to see, and whether you are interested in testing pre-release versions of TACO. You can do this by joining our insiders program, posting issues on stack overflow, or pinging me directly via e-mail at rsalva (at) microsoft.com. We look forward to hearing from you!

 

Ryan Salva

Ryan J. Salva, Principal Program Manager, Visual Studio Client Tools team
Twitter: @ryanjsalva

Ryan is a Principal Program Manager working in the Visual Studio Client Tools team where he looks after HTML, CSS and JavaScript development. He comes from a 15-year career in web standards development & advocacy as an entrepreneur, developer, and graphic designer. Today, he focuses primarily on mobile app development using web technologies and Apache Cordova.

Free Visual Studio Dev Essentials Program now includes $300 in Azure credits and Exclusive Xamarin University access

$
0
0

In November, we introduced the Visual Studio Dev Essentials Program to give developers everything they need to get started building and deploying apps on any platform, for free.

Over the past 75 days more than 400,000 developers have signed up for the program to take advantage of deep technical training from Pluralsight and Wintellect, as well as development tools, cloud services for team collaboration, OS downloads, mentoring and support.

Today we’re pleased to announce two new benefits for Dev Essentials members:

  • $300 in Azure Credits: enjoy $25/month in credits for 12 months to take advantage of Azure services for your apps.). That’s enough to run a D2 Windows Virtual Machine for 95 hours a month, or try out an A3 HDInsight Cluster for 24 hours. These credits can be applied on top of the free options offered by many Azure services. Learn more here
  • Xamarin University Access: get started building native iOS, Android, and Windows Phone apps using.NET and shared C# code through exclusive on-demand access to Xamarin University course recordings and materials.

If you haven’t already, join the thousands of developers who are already using Dev Essentials to stay nimble on the latest app development technologies. Sign up for Dev Essentials today and stay tuned for more great benefits in the coming months.

 

Shawn Nandi

Shawn Nandi, Senior Director – Developer Programs, Partnerships and Planning

Shawn drives partnerships and planning for the developer business at Microsoft as well as product management for Visual Studio developer programs and subscriptions.

 


Visual Studio Tools for Unity 2.2

$
0
0

A few months back we released Visual Studio Tools for Unity 2.1 (VSTU), the first release to be natively supported by Unity on Windows, making it much easier for game developers to use the rich capabilities of the Visual Studio IDE while developing Unity games.

Today, we’re pleased to announce the VSTU 2.2 release that fixes common integration issues that developers are facing.

You can download VSTU directly from Visual Studio or from the Visual Studio Gallery:

Main changes

  • The VSTU installer properly installs all the information that Unity looks for before enabling the native VSTU support.
  • For Unity on OS X with and Visual Studio in a virtual machine, Visual Studio properly detects and debugs Unity on the host.
  • For Unity 4.6, VSTU properly generates references to UnityEngine and UnityEditor.
  • The C# language version is now restricted to C# 4, the latest version of the language supported by Unity.
  • Fixed an error in the Unity package that could appear for projects without any script.

And for those of you working on multiplayer games, we’ve added support for the new networking messages in our wizards as shown below. Of course they’re context sensitive, and only appear if you’re actually working in a NetworkBehaviour.

Implement MonoBehaviors dialog

Updating to VSTU 2.2

The easiest way to update is through the update tab of the Visual Studio extension manager. To do it manually, download and install the VSTU version that matches the Visual Studio version you have installed and want to use with Unity, as described in the following sections.

Installing VSTU 2.2

Unity 5.2 or above

VSTU is natively supported and you just need to reinstall VSTU. In this scenario, you don’t need to import the VSTU package in your project, and you should delete the UnityVS folder of your project if you were using VSTU with a previous version of Unity. The solution we generate won’t be prefixed by UnityVS.

Just set Visual Studio to be the external editor in Unity:

Setting Visual Studio as the external editor for Unity

And you’ll see that the VSTU support is enabled in the About window of Unity as shown below.

Verifying that Visual Studio Tools for Unity are enabled

Unity 5.1 or below

You’ll still need to reimport our package in your project. The solution we generate will still be prefixed by UnityVS.

We strongly encourage VSTU users to update to 2.2. VSTU works best with the native support that was released with Unity 5.2, but we continue to support game developers on previous versions of Unity through the use of our VSTU Unity package. The full change log for this release is in our documentation.

As always, if you have any suggestion for the Visual Studio Tools for Unity, please post them on UserVoice, and if you encounter any issue please report it through the Visual Studio Connect site.

 

JB Evian

Jb Evain (@jbevain), Software Engineering Manager, Visual Studio Platform Team

Jb runs the Visual Studio Tools for Unity experience for the Visual Studio Platform team. He joined Microsoft last year as part of the acquisition of SyntaxTree, a company he founded and where he led the development of UnityVS. He has a passion for developer tools and programming languages, and has been working in developer technologies for over the last decade.

Write once and deploy to Microsoft Azure or Microsoft Azure Stack from Visual Studio

$
0
0

The Microsoft Azure Stack Technical Preview gives enterprises the ability to deliver Azure applications and services from their own datacenters. Today, we’re happy to share that we’ve built Azure Stack support into Visual Studio’s Azure Resource Group deployment process.

Enterprises today must manage both hyper-scale web applications and complex requirements such as ensuring regulatory compliance and data sovereignty. To meet these needs, Microsoft lets enterprises approach the cloud as a model rather than a place: Azure and Azure Stack share a standardized architecture, portal, and application model, allowing developers to write once and deploy to public, private, or hosted cloud environments without code changes.

With Azure Stack support in Visual Studio 2015 Update 1, developers deploying Azure Resource Manager templates with the Azure 2.8.2 SDK automatically find Azure Stack-hosted subscriptions for each cloud accessible within their accounts:

Deploy to Resource Group dialog in Visual Studio

Although the Azure Stack Technical Preview supports only a limited set of core and foundational Azure services, you can hit the ground running with some starter templates on the Azure Stack QuickStart Templates page.

So if you’re interested delivering Azure services out of your datacenter, check out the Azure Stack Technical Preview today to learn more and download bits!

Jason Shaver

Jason R. Shaver, Senior Program Manager – Azure Tools

Jason is a program manager working on Visual Studio and Azure tooling. He joined Microsoft in 2011 working on multiple XAML frameworks, including Silverlight and UWP. When not making it easier for developers to unlock the cloud’s potential, he is working on using home automation and IoT to build the perfect home office.

Visual Studio 2015 Update 2 CTP

$
0
0

Today we released Visual Studio 2015 Update 2 CTP. Our focus for this release has been stability and performance, along with responding to feedback you’ve given us on Visual Studio 2015 RTM and Update 1.

Here are the biggest things you’ll find in this update:

  • Fixes for quite a number of bugs:
    • Crashes when editing C# or Visual Basic files while editing
    • Crashes when updating error list entries for C# and Visual Basic projects while editing
    • Out of memory exceptions when C# and Visual Basic projects are kept open for long sessions
    • Delays when opening C++ projects
    • Over 300 C++ compiler bugs (some address code-generation issues and required breaking changes; see Breaking Changes in Visual C++ 2015 Update 2)
    • Errors when creating document-level projects for Office 2016 with the Office Developer Tools
    • Hangs when trying to access local help
  • Setup fixes:
    • Hangs in setup when using read-only or disconnected drives
    • Failures with uninstallable packages and when selecting features
  • C# and Visual Basic Analyzer API improvements for better performance and control over whether analyzers run in generated code.
  • In Visual Studio 2015 Update 1, we introduced a faster database engine for C and C++ that speeds up operations like Go To Definition and Find All References but turned it off by default. With Update 2, new Visual Studio installations use this new engine by default; if you’re upgrading from Update 1 to Update 2, note that you’ll continue to use whatever engine you already had selected. In any case, you can select the engine via Tools > Options > Text Editor > C/C++ > Experimental.

Setting the C/C++ database engine in Visual Studio 2015 Update 2 CTP

We’ve also added a number of features across a variety of languages and tools that you can read about in the release notes. There are two that I’d like to call our here:

  • Visual Studio is now compatible with Git repos configured to use Git LFS (Large File Storage). Learn more about Git LFS here: https://git-lfs.github.com/.
  • Seeding the C# Interactive Window with a project context, and the addition of Send To Interactive commands.

Again, there’s much more, including additional Git-related improvements, that you can find in the release notes: Description of Visual Studio 2015 Update 2 CTP.

We’ve also released Team Foundation Server 2015 Update 2 RC 1 today. You can see what’s new there in the TFS Update 2 RC 1 release notes.

As always, we welcome your feedback. For problems, let us know via the Send Feedback option (Send a Smile) in Visual Studio. For suggestions, let us know through UserVoice.

John Montgomery

John Montgomery is the Director of Program Management for Visual Studio, responsible for product design and customer success for all of Visual Studio, C++, C#, VB, JavaScript, and .NET. John has been at Microsoft for 17 years, working in developer technologies the whole time. Reach him on Twitter @JohnMont

Find Your Favorite Visual Studio Extension

$
0
0

One of the greatest strengths of Visual Studio is the vibrancy of the partner ecosystem that surrounds it. There are thousands of extensions available for Visual Studio that enhance the editor experience, support new languages, add time-saving components to your toolbox, and integrate with other developer services. In the last year alone, over 1,000 free and paid extensions have been added to the Gallery, and of those we wanted to highlight a few of our favorites and encourage you to try them out for yourself!

Alive

Alive brings live coding to Visual Studio. As you write C# code, the Alive extension runs it and displays immediate results directly in the editor. This shows you what your code is doing without taking the time to run your application in the debugger.

Download the Alive extension from the Visual Studio Gallery and enjoy a 30 day preview.

Alice extension for Visual Studio

Visual Commander

Do a lot of your tasks feel repetitive? Automate them with the free Visual Commander extension. You can record keyboard commands for the Visual Studio editor as a macro and play them back, or reuse existing macros from earlier versions of Visual Studio.

Download Visual Commander from the Visual Studio Gallery.

Visual Commander extension

OzCode

OzCode improves the Visual Studio debugger experience with many useful features. For example, it color-codes if statements and highlights variable assignments to visualize what your code is doing while you step through each statement. OzCode also adds details about each exception and lets you easily navigate to it, and offers much more such as a heads-up display, enhanced breakpoints, a historical view of code execution, Magic Glance, and just too much to list here. Check it out for yourself!

Download OzCode from the Visual Studio Gallery for a 30 day trial.

Improving the debugging experience with OzCode

IncrediBuild

IncrediBuild accelerates your development by optimizing your tool chain, including make and build tools such as MSBuild, development tools such as Team Foundation Server, unit and static code analysis tools such as MSTest, VSTest, and FXCop, game development such as Xbox, as well as Azure and other cloud services and Visual Studio Online. For a more complete recap, see last November’s post on this blog, Improving your build times with IncrediBuild and Visual Studio 2015.

Download IncrediBuild from the Visual Studio Gallery for a 30 day trial

IncrediBuild for Visual Studio

Perfecto Lab for Visual Studio

As a mobile developer you know about the challenges of making sure your app works on the vast number of different hardware and OS configurations in the market. This is where the Perfecto Lab integration will come in very handy! With the Perfecto extension you can run tests in the Perfecto device cloud straight out of Visual Studio and get feedback on how your app behaves on real hardware.

Get started with Perfecto Lab for Visual Studio from the Visual Studio Gallery. The extension requires an account with Perfecto Mobile (free trial of 50 hours/month for 3 months).

PerfectoLab for Visual Studio

We want to hear from you

We hope you will find this selection of Visual Studio extensions useful, and you can discover many more in the Visual Studio Gallery. Let me know your favorites in the comments, too! And if you have general feedback about Visual Studio extensibility, take a look at Visual Studio Extensibility on UserVoice.

Michael Dick

Michael Dick, Program Manager, Visual Studio
Michael Dick is a Program Manager working on the Visual Studio team. Before joining Microsoft, Michael worked at a variety of tech companies and is passionate about developer tools. He is currently focusing on the ecosystem and extensibility experience for Visual Studio.

Analyze CPU and Memory while Debugging

$
0
0

Would you like to learn how to make your code run faster, use less memory, or just find out whether your code has a CPU or memory issue? Of course you would—you’re a developer! But then, memory and performance tuning often suffers from the pitfall of being an “important but not urgent” task that you simply can’t seem to get to because of the really urgent stuff. So why not bring that task little closer to you?

In this post we’ll look at how using the debugger-integrated performance and memory tools in Visual Studio 2015 Update 1. Without leaving your debugging workflow, these tools let you quickly answer questions like “how is my memory footprint?” “what is using all this memory?”, “should I be concerned about the performance of this code?”, and “why is this so slow?”. Although we show ASP.NET in this post, these tools also work when debugging Windows desktop applications and C#/VB/C++ universal Windows applications that target desktop.

If you like what you see in this blog post, please join our Visual Studio Performance Tools Community to stay up-to-date and help steer future features.

Finding Performance and Memory Problems

The first step in optimizing the performance of your code is to know where to make improvements. To help with this, PerfTips and the Diagnostics Tools window in the Visual Studio 2015 debugger give you inline, glance-able performance information.

To use PerfTips, just set a breakpoint and step over a line of code, and you’ll see the PerfTip appear to the right of the instruction pointer (the yellow arrow) with the elapsed (wall-clock) time. In this case it tells us that line 57 took 1406ms to run, which is usually a combination of time spent waiting on I/O (e.g. an HTTP call or reading a file from disk) and time spent executing code on the CPU:

PerfTips

If this number is higher than you’d like, run the same code a few more times to see if you get consistent results. In many cases, you can Click+Drag the instruction pointer (yellow arrow) back to re-run code without having to stop your debug session.

To look at your app’s CPU and memory consumption, open the Diagnostic Tools window (Debug > Show Diagnostic Tools or Ctrl+Alt+F2):

Diagnostics tool window showing CPU and memory consumption

The Diagnostic Tools window opens by default when you start debugging, and you can leave it open to keep an eye on your app’s CPU and memory consumption whenever you are debugging.

Hover over the CPU and memory graphs and you’ll see a tooltip that shows the application’s private memory and percentage of CPU consumption at any point in time:

Tooltips showing point-in-time CPU and memory consumption

Above the memory graph you’ll see a timeline of the breakpoints and steps you took so that you can relate CPU and memory consumption to specific sections of code:

Timeline of breakpoints above the memory graph

Again, if you see something that is higher than you expect, run the code multiple times to see if you get similar values. Or click on one of the break events (the rectangles) to set the selected time range to that event, which is useful for viewing the detailed CPU usage information shown in the next section.

If you decide to make an improvement, a few more clicks gets you a breakdown of CPU and memory usage to help identify opportunities for improvement. We’ll show you how to do this next!

Reducing CPU Usage

When you identify a spike in CPU usage, your first instinct might be to try out a few code alternatives and see which ones use the least amount of CPU. But if you have no idea what the problem might be, or want to verify what code path is causing an issue, click on the CPU Usage tab in the Diagnostic Tools window, and then click CPU Profiling to start recording the functions that are running on the CPU:

CPU Usage tab and CPU Profiling command to start recording

Doing this samples the call-stack on the CPU once per millisecond, which adds a small amount over performance overhead to debugging. It’s generally small enough, however, that you can leave it running during your debugging sessions.

The simplest way to view CPU data is to set breakpoints at the start and end of the section of code of interest, as lines 55 and 65 below. When the debugger hits line 55, press F5 to run that block of code (and notice the PerfTip that appears on line 65!):

Setting breakpoints over a section of code to profile

The Diagnostic Tools window automatically sets the current time selection to the time between these two breakpoints (as if you had clicked on a break event). You can also set the time range selection by clicking and dragging on a CPU spike in the graph. In both cases, the table in the CPU usage tab shows a call-tree filtered to the selected range of time:

CPU profiling call tree

The call-tree provides an aggregated view of all of the recorded call stacks. You can expand the nodes in the tree to follow a series of function calls (or portion of a call stack) and see the CPU usage within that code-path under. Total CPU (ms) shows the approximate time spent in a given function and all its parent calls; and Total CPU (%) provides a percentage breakdown of the Total CPU (ms) column.

Here we see that we spent 1067ms in DeserializeDriversJSON when it was called by GetDriverList, which was in turn called by GetIndividualDriverCached, and so on. Right-click on any function and select View Source to examine the code and look for ways to reduce calls to that function, or reduce the number of calls it makes to other functions.

Reducing Memory Consumption

To view a breakdown of memory usage, open the Memory Usage tab in the Diagnostic Tools window and click Take Snapshot. By taking a snapshots both before and after an increase in memory lets you to filter the view to see what changed between the two in terms of Objects and Heap Size:

Comparing memory usage between two snapshots

When you take two or more snapshots, the numbers in parenthases show the differences from the previous snapshot in the table. All the blue text are hyperlinks that open the heap view to see the full set of objects captured in that snapshot, including a Count of objects, their Size, and the Inclusive Size of all instances of that type plus the size of all referenced types:

Examining objects and memory size in the heap

In this case, we have 100,025 DocumentResponse.Driver objects in our heap totaling about 91MB in size.

Clicking a link in the parentheses lets you analyze the differences more specifically:

Link to analyze memory differences more specifically

Analyzing memory differences more specifically

Sorting by Inclusive Size Diff points you to the objects responsible the memory growth between the two snapshots. In this example, the diff view shows 5 new driver objects with ~54MB of memory growth between the two snapshots. The inclusive size of DriverCache, Dictionary, and List objects indicates that they are all possible culprits.

When viewing managed snapshots, you can select an object to view the references to and from objects of that type. The Paths to Root tab shows the references that other objects hold to the selected type:

Paths to Root tab showing object references

Here we see that the DriverCache object has a dictionary, which created 5 new references to driver objects between the two snapshots. To jump into DriverCache to see what it’s doing, just right-click and select Go to Definition.

The Referenced Types tab shows objects that the selected type is referencing:

Referenced Types tab showing objects and memory

Here we see that the Driver objects added references to 50MB worth of byte arrays, and 2MB worth of strings between the two snapshots.

Similar steps to what we’ve seen here also works for C++ with some small differences. When debugging C++, first toggle the “Heap Profiling” button before you can take snapshots, and instead of using the references list you can view instances of a particular type and then see the allocation stack for each instance.

Learning More

These are simple ways you can measure performance and memory of your app in a few minutes the next time you’re using the Visual Studio debugger. Now that you’ve learned the basics, you can learn more by checking out the following posts:

We also encourage you to join our Visual Studio Performance Tools Community for updates about new features, and to give us feedback about these and other performance tools!

 

Dan Taylor

Dan Taylor, Program Manager, Visual Studio

Over the past few years Dan has been driving development of the Performance and Diagnostic tools in Visual Studio, including the Diagnostic Tools window, PerfTips, and performance tools for Windows Store and Windows Universal apps. Prior to that he was driving various performance improvements in the .NET Framework and CLR across Windows 8, Windows Phone 8 and Windows Server.

Node.js: From Zero to Bobble with Visual Studio Code

$
0
0

Node.js is a platform for building fast, scalable applications using JavaScript. It’s making its way just about everywhere – from servers, to Internet of Things devices, to desktop applications, to who knows what next?

Ooh—I know what next…bobbleheads!

Satya Nadella bobblehead

Bobblehead Generator

Of course, we don’t just want one bobblehead…we want so many bobbleheads! So let’s have a bit of fun with Node.js—for beginners and experienced Node developers alike—by implementing a bobblehead generator as follows:

  1. Build a simple web service for uploading images using the popular express Node.js web framework.
  2. Do face detection using the artificial intelligence based APIs from Microsoft’s Project Oxford.
  3. Crop, rotate, and paste the face rectangle onto the original image at various angles.
  4. Combine those images into a GIF!

Overall flow of the Bobblehead Generator

Ready, set, Node!

To start, go ahead and install the following:

  • Node.js v5.x: the latest stable Node.js release, which comes bundled with npm v3 for installing dependencies maximally flat.
  • Visual Studio Code: Microsoft’s free, cross-platform editor (Windows, OS X, and Linux) that comes with some nifty debugging and IntelliSense features for Node.js.
  • Git: which we’ll use to deploy our app to Azure.

Scaffolding the application

First, use npm to install the express-generator package globally.

C:\src> npm install express-generator -g

Next, run the following commands (and of course you don’t need to enter the comments!):

C:\src> express myapp #generate Express scaffolding in a project folder
C:\src> cd myapp #switch to the project folder
C:\src\myapp> npm install #install dependencies in package.json
C:\src\myapp> code . #start Visual Studio Code in this folder!

In Visual Studio Code, open the Explore pane on the left hand side to see what’s been generated.

Explore pane in Visual Studio Code

  • package.json: lists required 3rd-party dependencies and other useful configuration info. npm install goes through this file to download and installs each dependency automatically.
  • node_modules: this is where npm install stores all those dependencies.
  • bin/www: the application entry point (www is a JavaScript file even though it doesn’t have a .js extension). Note that it uses require('../app.js') to invoke the code in app.js before it goes on to spin up the relevant ports.
  • app.js: the application configuration boilerplate.
  • views/*: templates that are rendered as client-side UI; here we’re using the Jade templating engine (see app.js). There are many such engines to choose from, depending on your preference.
  • routes/*: defines how various requests are handled. By default, the generated template handles GET requests to /, and /users.

Let’s verify that this newly-scaffolded app is working. Just run node ./bin/www from the command line, then visit localhost:3000 in a browser to see the app running.

Press Ctrl+C on the command line to stop the server, because we now need to install a few other npm packages as follows:

C:\src\myapp> npm install --save gifencoder jimp multer png-file-stream project-oxford

If you’re new to npm, the --save parameter instructs npm to also create entries for these packages in the “dependencies” section of your package.json. This way, if you give your source code to other developers without all the packages in node_modules (as when you put code in a repo), they can just do npm install to quickly download all those dependencies.

Additionally, you can always just add dependencies directly to package.json, where Visual Studio Code gives you IntelliSense and auto-complete for available packages and their current versions! Then you can just run npm install again to do the work.

Here are two more very helpful npm tips:

  • To view the documentation for a dependencies, run npm doc <package-name>
  • If you use the --save-dev parameter instead of --save, the dependency is written into a section called “dev-dependencies”. This is where you list packages for development tools like test frameworks and task runners that won’t be included in the deployed application.

Configuring your Editor: debugger launch and IntelliSense

To minimize context-switching, let’s configure Visual Studio Code to launch the application directly from the editor. Press F5 and select the Node.js debug engine to automatically generate the .vscode/launch.json configuration file. Now, simply press F5 again to launch the app with the debugger attached. Set a breakpoint in routes/index.js and try reloading localhost:3000. You’ll find that you can use the debugging pane to inspect the call stack, variables, etc.

Inspecting variables in the debugger

Visual Studio Code also provides code completion and IntelliSense for Node.js and many popular packages:

Code completion and IntelliSense for Node.js

Because JavaScript is a dynamically-typed language, IntelliSense relies heavily on typings files (.d.ts) that are often included with npm packages. The community has also contributed typings files that you install using the tsd (TypeScript definitions) package:

C:\src> npm install tsd –g          #install tsd as a global tool
C:\src> cd myapp
C:\src\myapp> tsd install express   #install IntelliSense for express

Uploading a file

The scaffolding for the application includes a basic Express web service, so let’s have it accept a file upload. First, add a basic browse and upload UI by replacing the contents of views/index.jade with the following template:

<!-- views/index.jade -->
 
extends layout
 
block content
  div(style='width:400px')
    h1= title
    p= location
    p Upload a picture of a head to get started!
 
    form(action='/'       method='post' enctype="multipart/form-data")
      input(type="file" name="userPhoto")
      input(type="submit" value="Upload Image" name="submit")

    img(src= image)

If you restart the app here in Visual Studio code and refresh localhost:3000 in the browser, the UI is available attempting to upload a file gives you a 404 error because we’re not yet handling the POST request. To do that, stop the debugger and append the following code to routes/index.js to process the file in req.file.path, ultimately to display the output bobblehead on the page.

// Required Dependencies
var fs = require('fs');
var oxford = require('project-oxford');
var Jimp = require('jimp');
var pngFileStream = require('png-file-stream');
var GIFEncoder = require('gifencoder');

// Handle POST request
router.post('/', function (req, res, next) {
    var imgSrc = req.file ? req.file.path : '';
    Promise.resolve(imgSrc)
        .then(function detectFace(image) {
            console.log("TODO: detect face using Oxford API.");
        })
        .then(function generateBobblePermutations (response) {
            console.log("TODO: generate multiple images with head rotated.");
        })
        .then(function generateGif (dimensions) {
            console.log('TODO: generate GIF')
            return imgSrc;
        }).then(function displayGif(gifLocation) {
            res.render('index', { title: 'Done!', image: gifLocation })
        });
});

JavaScript’s asynchronous nature sometimes makes it challenging to follow application flow. Here we’re using the new EcmaScript 6 feature of Promises to sequentially execute detectFace, generateBobblePermutations, and generateGif while keeping our code readable.

Now when you run the app you should see the three TODOs on the console, but we’re still not saving the file to any particular location. To do that, add the following code to app.js right before where the / and /users routes are defined with app.use (around like 25):

// Expose files available in public/images so they can be viewed in the browser. 
app.use('/public/images', express.static('public/images'));

// Use multer middleware to upload a photo to public/images
var multer = require('multer');
app.use(multer({dest: './public/images'}).single('userPhoto'));

With this, restart the application and you’ll see it render an uploaded photo, which is stored in public/images.

Detect the face

It sounds like a lot of work, but fortunately this kind of artificial intelligence is ready accessible through the Face APIs of Project Oxford. In routes/index.js, make the detectFace function in the promise chain look like the following:

function detectFace(image) {
    var client = new oxford.Client(process.env.OXFORD_API);
    return client.face.detect({path: image});
}

As you can see, you’ll need an API key retrieved from the OXFORD_API environment variable to use the Project Oxford client. Click here to sign up (free), then request an also-free Face API key. This will appear on your subscriptions page (click Show to see the key): API keys for Project Oxford Next set the OXFORD_API environment variable on your machine to the Primary Key value, so that it is available to your code through the process.env.OXFORD_API property. (Note: you may need to restart Visual Studio Code after setting the variable for it to be picked up.) This is generally a much better practice than pasting a secure key into code that might be publicly visible in a repository.) Now set a breakpoint on the console.log call within the generateBobblePermutations step, run the application, and verify that face detection worked by checking response[0].faceRectangle. (Again, restart Visual Studio Code if you see an error about the API key not being there.) Verifying that face detection works by checking response[0].faceRectangle The Project Oxford APIs are pretty neat, so definitely explore the other APIs and options you can set. For instance, passing the following options into client.face.detect tries Project Oxford’s hand at guessing an age and gender for the person in the photo (this is the same technology that powers https://how-old.net/).

{
    path: image,
    analyzesAge: true,
    analyzesGender: true
}

Crop, rotate, and paste the face in various configurations

To produce an animated bobblehead GIF, we’ll create three images with different rotations of the detected face area. For this, paste the code below in place of the generateBobblePermutations function in routes/index.js:

function generateBobblePermutations(response) {
     var promises = [];
     var degrees = [10, 0, -10];

         for (var i = 0; i < degrees.length; i++) {
             var outputName = req.file.path + '-' + i + '.png';
             promises.push(cropHeadAndPasteRotated(req.file.path,
                 response[0].faceRectangle, degrees[i], outputName))
         }
    return Promise.all(promises);
}

The workhorse here is the following cropHeadAndPasteRotated function that you need to append to routes/index.js:

function cropHeadAndPasteRotated(inputFile, faceRectangle, degrees, outputName) {
    return new Promise (function (resolve, reject) {
        Jimp.read(inputFile).then(function (image) {
            // Face detection only captures a small portion of the face,
            // so compensate for this by expanding the area appropriately.
            var height = faceRectangle['height'];
            var top = faceRectangle['top'] - height * 0.5;
            height *= 1.6;
            var left = faceRectangle['left'];
            var width = faceRectangle['width'];
 
            // Crop head, scale up slightly, rotate, and paste on original image
            image.crop(left, top, width, height)
            .scale(1.05)
            .rotate(degrees, function(err, rotated) {
                Jimp.read(inputFile).then(function (original) {
                    original.composite(rotated, left-0.1*width, top-0.05*height)
                    .write(outputName, function () {
                        resolve([original.bitmap.width, original.bitmap.height]);
                    });
                });
            });
        });
    });
}

This function reads the uploaded image, then expands the boundaries of faceRectangle to capture the full head (rather than just a portion of the face). We then crop this area, scale it up a bit, rotate it, and paste back to the original image.

Because we’re doing asynchronous work here, the images created by from cropHeadAndPasteRotated are not available immediately. This is why we call resolve to inform the application that the file has been written successfully.

Running the application now, you’ll find three PNG files in public/images alongside the original image. You can click on these in Visual Studio Code to see them directly in the editor.

Produce a GIF

We’re ready for the final step! We’ll use the gifencoder and png-file-stream libraries (we installed these with npm earlier) to compose the images generated above into a single GIF. Just replace the generateGif code in routes/index.js with the following:

function generateGif(dimensions) {
    return new Promise(function (resolve, reject) {
        var encoder = new GIFEncoder(dimensions[0][0], dimensions[0][1]);
        pngFileStream(req.file.path + '-?.png')
            .pipe(encoder.createWriteStream({ repeat: 0, delay: 500 }))
            .pipe(fs.createWriteStream(req.file.path + '.gif'))
            .on('finish', function () {
                resolve(req.file.path + '.gif');
            });
    })
}

Go ahead, run the code, and start generating bobbleheads!

Locally running bobblehead generator

To the cloud!

There’s no way we’re going to achieve viral-quality bobbleheads with a mere locally-running app, so let’s see what we can do about that by using Git Deploy to deploy our app to Azure.

To initalize our repository, open the Git pane on the left side of Visual Studio Code and select Initialize git repository:

Git pane in Visual Studio Code, initialization step Git pane in Visual Studio Code showing changes

 Whoa. 1000’s of changes?? That’s way too much. Let’s cut that down a bit. Create a file in the project root with the File > New File command (Ctrl+N), paste in the text below, and save the file as .gitignore:

# .gitignore
 
node_modules
public/images

That’s better! We don’t need to add all the packages in node_modules to the repo, and we can certainly ignore our uploaded and generated test images. In the Git pane, now you’ll see just a few files to commit to your local repo, entering a message and clicking the checkmark:

Commit code to Git in Visual Studio Code

Next, head on over to https://try.azurewebsites.net to create a free one-hour trial website:

  • Select Web App for the app type and click Next.
  • Select Empty Site for the template and click Create
  • Select a login provider, and in a few moments you’ll have a new site to use for the next hour!

Portal for try.azurewebsites.net after creating an web app

Now, grab the git url for your web app (as outlined above), and push your code to the remote repository using the following command, replacing <git url> with the long bit you just copied from the portal:

C:\src\myapp> git push --set-upstream <git url> master

The command window shows the status of your deployment. Especially notice that in addition to copying the files in your project, Azure automatically runs an npm install for all your required dependencies as specified in package.json. Remember earlier that by listing all your dependencies in package.json, anyone who gets your source code without everything in node_modules can easily restore all the required packages. Deploying to Azure works exactly the same way, and it’s why you don’t need to add everything under node_modules to the repo.

Now although you can visit this new site, you won’t be able to generate the bobblehead just yet because the OXFORD_API environment variable is not set. Azure’s temporary 1-hour sites do not permit you to set environment variables, so we’ll just edit routes/index.js directly and drop in the primary key. To do this, click the “Edit with Visual Studio Online ‘Monaco’” link:

Edit with Visual Studio Online "Monaco" link

This takes you to an editor interface that looks very much like Visual Studio Code—open the Explore pane, navigate to routes/index.js, and paste in your primary key in quotes. Your change will be automatically saved:

Editing in Visual Studo Online "Monaco" to hard-code the primary key

Now in the browser, click on the URL after Work with your web app at … and Bobble away! (I’d suggest you can share your bobbleheard generator with the world, but you probably have only about 35 minutes left!)

Next steps

Our bobblehead generator is clearly demo-ware and nowhere close to production ready. Here are some things you can do to take it in that direction:

  • Try refactoring and separating out some of the code into separate modules.
  • Try passing in different image types, or images with multiple or no faces, etc. Debug any issues you run into using Visual Studio Code, and see how you might be able to do even better!
  • Instead of saving images locally, try playing around with the Azure Storage APIs or MongoDB.
  • Explore npmjs.com and find other useful packages to play around with, or—better yet— publish your own!

Be sure to also check out the following set of resources that should help you along the way:

  • Visual Studio Code: our new lightweight and cross-platform editor that offers powerful debugging and IntelliSense for Node.js.
  • Node.js Tools for Visual Studio (NTVS): Can’t get enough of Visual Studio? NTVS is free, open-source extension that turns Visual Studio into a full-blown Node.js IDE.
  • Microsoft/nodejs-guidelines: A helpful set of tips and tricks for using Node.js, as well as links to some of the other cool Node.js efforts going on at Microsoft.

Questions, compliments, complaints?

We’d love to hear your feedback. Please comment below or shoot me a tweet! ALso be sure to check out the other nine (or ten) things to try on the leap day!

Sara Itani Sara Itani (@mousetraps), Software Engineer, Node.js Tools
Sara is an engineer focused on building best-of-breed Node.js experiences for Visual Studio and VS Code. At first, she was skeptical about Node.js – that is, until she realized its full potential…. Now, she’s all in, and excited to help it take over the world by bringing the power of Visual Studio to the Node.js community. She, for one, welcomes our new JavaScript overlords. :-)

10 things you should try on the leap day

$
0
0

It’s February 2016 and so those of us on the Gregorian calendar get to enjoy an extra day in the month! What will you do in those 24 bonus hours? How about learning some new tools and technologies? Here are ten great suggestions—OK, eleven! It is a leap year, so it’s a leap list:

  1. Get your code hosted for free in Visual Studio Team Services
  2. Talking with Python (literally!)—Fabrikam Pizza Shack
  3. Check out the top 5 Visual Studio extensions
  4. Build a Universal Windows app—quick and easy
  5. Explore Azure Diagnostics Integration with Application Insights
  6. Build a C# or Visual Basic Analyzer and Code Fix
  7. Try out the new HockeySDK for Universal Windows apps
  8. Go from Zero to Bobble (a Satya Nadella bobble!) with Node.js and Visual Studio Code
  9. Analyze CPU and Memory while debugging
  10. Build an app with Visual Studio Code + Apache Cordova + Ionic
  11. Leap Day Bonus! Build an Azure App Service to record Raspberry Pi Sensor Data

Get your code hosted for free in Visual Studio Team Services: With all of these new projects to try out on leap day, make sure you’re putting them into source control on VS Team Services. Creating a free repo to host your code is easier than ever, and because Team Services provides unlimited free repos, you can create a new repo for each of your leap day projects! If you have other projects that aren’t yet hosted in Team Services, don’t worry–getting them added is easy. Back to top

Exploring a code repository in Visual Studio Team Services

Talking with Python (literally!)—Fabrikam Pizza Shack: Sick of being a developer? Over on the Python Engineering blog, we’re starting the next multi-million dollar pizza chain! First task: an ordering system that uses Project Oxford for speech recognition, natural language analysis, and text-to-speech from Python. With any level of Python experience (even none), you can help us become the number one Python-based natural user interface pizza shop. Back to top

Python code for a pizza shop

Check out the top 5 Visual Studio extensions: What’s your favorite Visual Studio extension? We could not decide on only one, so we are introducing you to five of our favorites. Try out one of them yourself or explore the thousands of extensions on the Visual Studio Gallery to find your favorite. Back to top

OzCode extension for Visual Studio

Build a Universal Windows app—quick and easy: Curious about diving into Universal Windows apps but never had the time or didn’t know where to start? How about using your leap day to learn to make your first UWP app? It’s easy to get started using our sample template to create an app for your next big event. Share it with your friends to provide details, share photos, and give your event a unique digital touch. With plenty of step-by-step guides and resources, we take you app from typing your first line of code all the way to submitting the app to the store! Back to top

Building a universal Windows app

Explore Azure Diagnostics Integration with Application Insights: What do you do when your Azure Cloud Services (web and worker roles) or Virtual Machines fail? Would you like to easily detect when they crash, have performance problems, or experience other issues? How cool would it be if you could understand the exact impact of these issues on your application and its users? Well, this has become an easy task now that you can send your Azure Diagnostics telemetry to Applications Insights. Back to top

Azure Diagnostics integration with Application Insights

Build a C# or Visual Basic Analyzer and Code Fix: C’mon, admit it—you’ve always wanted to play around with code analysis in the .NET Compiler Platform (“Roslyn”), haven’t you? Say you’re a team lead, architect, or library author. You can provide live code analysis and fixes to make sure your developers are “doing it the right way”. Instead of reading through piles of documentation, your developers can learn how to use your libraries and frameworks in real time. Take a look at the walkthroughs for C# and Visual Basic to see how to create debugger warnings that target either language—just perform a bit of analysis to identify an issue and optionally provide a code fix. Then Visual Studio does the rest to surface the issue in the IDE. Back to top

Analyzing .NET code

Also take a look at some of the open source analyzers you can use in your projects today like Code-Cracker, Refactoring Essentials and .NET Analyzers. Back to top

Try out the new HockeySDK for Universal Windows apps: Great news for UWP developers—we’ve been working hard on the HockeySDK for UWP apps on Windows 10 and invite you to spend some of your leap day trying the pre-release version of the SDK. With it you’ll get to explore user behavior metrics and live crash reports. Back to top

HockeySDK for universal Windows apps

Go from Zero to Bobble with Node.js and Visual Studio Code: Have some great fun learning Node.js by building a Bobblehead Generator! The project you create with this post includes a web service built on Node.js and the Express framework, face detection with the Project Oxford API, a little image processing, and programmatic GIF creation! Back to top

Bobblehead generator in Node.js

Analyze CPU and Memory while debugging: What better use for a leap day than learning how to make your code run faster and use less memory? Or perhaps you just want to find out how much CPU and Memory your app is using. Now is the time to explore some of the great analysis and profiling features that are integrated into the Visual Studio 2015 debugger! Back to top

Analyzing CPU and memory usage while debugging

Build an app with Visual Studio Code + Apache Cordova + Ionic: The team that builds the Tools for Apache Cordova (TACO) suggests that you spend the leap day developing a fun, quirky mobile app for Android, iOS, and Windows all at once in the web technologies that you love—JavaScript, jQuery, Angular. Experience development in Visual Code—a marriage of a lightweight code editor and Visual Studio’s robust IntelliSense—as you use the new Cordova extension to build out an app to categorize your antique golf balls! Back to top

Apache Cordova in Visual Studio Code

Build an Azure App Service to record Raspberry Pi Sensor Data: Perhaps we saved the best for last? Well, if you’re a developer with a Raspberry Pi begging for a project, why not spend your extra day diving into some real IoT by wiring it up to send data to an API running in Azure App Service? We’ve got a great walkthrough on the Azure blog that’s ready to guide you through the process! Back to top

Raspberry Pi connected to an Azure App service

 

 

From all of us here at Microsoft working on developer tools, we hope you have a fun and productive leap day!


Develop ReactNative apps in Visual Studio Code

$
0
0

ReactNative is a great way to build native, cross platform app for iOS and Android using JavaScript. We recently announced the launch of a Visual Studio Code Extension that enables you to build, debug and preview Apache Cordova apps. And today we’re pleased to announce the availability a similar extension for ReactNative!

ReactNative vs. Apache Cordova

Many of you may already be familiar with Apache Cordova as an open-source project that enables web developers to build mobile apps with full access to native APIs and offline support. In a Cordova app, the entire UI executes inside a full-screen WebView where you can leverage the same HTML, CSS and JS frameworks found on the web. But, since the UI is rendered in the WebView, it can be difficult if not impossible to achieve a truly native look and feel.

ReactNative apps are also written with JavaScript – or, more specifically, they are written with the React/JSX framework. But, rather than run in a Webview like Cordova, code runs in a JavaScript engine that’s bundled with the app. ReactNative then invokes native UI components (e.g. UITabBar on iOS and Drawer on Android) via JavaScript. This means that you can create native experiences that aren’t possible with Cordova.

That said, Apache Cordova is presently a more mature and stable technology that lets you write a common UI layer using web technologies, whereas ReactNative is much newer and still requires you to write distinct UI layers. If your app requires native UI and you enjoy the excitement of a rapidly evolving JavaScript platform, then ReactNative might be an option to consider.

Lighting up the ReactNative authoring experience

When we asked ReactNative developers what would make them more productive, they gave us plenty of inspiration for customer-driven features that we could add to Visual Studio Code to light up the authoring experience:

  • Syntax highlighting and autocomplete capabilities for both JavaScript statements and JSX snippets in the source files.
    Syntax highlighting and autocomplete for ReactNative in Visual Studio Code
  • Commands to deploy and debug the app on emulators and devices without having to leave the editor.
    Command to deploy and debug app without leaving the editor
  • The ability to set breakpoints and have a full set of debugging tools readily available the editor, like watching variables and inspecting stack traces:
    Setting breakpoints and debugging

All of these will work directly with your existing ReactNative projects, no changes required!

How do I get it?

It’s easy. First, make sure you have Visual Studio Code installed from http://code.visualstudio.com. It’s under 50MB, completely free, and runs on Mac OS X, Linux, and Windows. On a decent network connection you’ll have it installed in under 2 minutes!

Then visit the Visual Studio Code Marketplace to get the ReactNative extension. You can also install it directly from within the editor. Simply invoke the Command Palette (Cmd+P on Mac, Ctrl+P on Windows), type >ext install reactnative, and hit Enter.

The extension is also open source and available on github and we would love your contributions to make it better. You can open issues on github or even better, send us pull request with those awesome features you need.

What’s Next?

Our team is working on delivering great developer tools and would love to hear from you. Whether you run into issues, have comments or ideas for areas related to ReactNative we should be looking at, please do get in touch with us.

You can email me directly at panarasi (@) microsoft.com or join our insiders program. You can also find us on the reactiflux discord server (look for “lostintangent” or “axemclion”), usually in the #code-push channel. We look forward to your input!

As mentioned earlier, this extension is a logical extension of our work that we are doing with Apache Cordova. Our team continues to invest heavily in Apache Cordova and its tooling. We would love to help you with your questions or discuss any ideas that you may have with Cordova, please feel free to ping us about that too.

Parashuram is a Program Manager on the Visual Studio Client team working on cross platform mobile application development using Javascript and other Web technologies. He is also an Apache Cordova committer and contributes to many open source projects.

Top news from January 2016

$
0
0

The year has gotten off to a great start and it seems that .NET, the web, and TypeScript get the prize for the most popular topics!

ASP.NET 5 is dead: Did we get your attention with that heading? Well, it’s not dead at all, it just has a new moniker as Scott Hanselman explains in Introducing ASP.NET Core 1.0 and .NET Core 1.0. I love the quote from Phil Karlton, “There are only two hard things in Computer Science: cache invalidation and naming things.” That about says it all!

ASP.NET Code 1.0 and .NET Core 1.0

Elsewhere in Web development: If you’ve ever wanted to explore the Chakra engine used in Microsoft Edge and Internet Explorer, now is your chance as the ChakraCore GitHub repository is now open. But then again, perhaps you’re not quite ready to delve into the intricacies of JITing and such, so you might find that Channel 9’s Microsoft Tools for Beginner Web Developers (22m 8s) is just the ticket. Or maybe it’s time you explored all the fun stuff in Node.js, Express, AngularJS, and MongoDB starting with Ashwin Shetty’s Getting Started with MEAN Stack. I personally had the opportunity to do a MEAN stack course through Global Knowledge in January, and greatly enjoyed spending a whole week with nothing but Visual Studio Code, npm, and quite a number of different documentation sites!

Introduction to Angular JS, and AngularJS+TypeScript: Ashwin’s post above is just going to get your first toe into the client-side waters of the MEAN stack, which is AngularJS. When you’re ready for more—much more—head on over to Microsoft Virtual Academy and enjoy this free comprehensive course by Christopher Harrison and Stacey Mulcahy. You might then continue with another full course on Angular Applications with TypeScript with Bill Wagner and James Sturtevant, but if you don’t have a half-day to spend with that, maybe you have a couple of minutes to learn how Google engineers from Angular core development team are building Angular 2 with TypeScript.

Learn how Google engineers from Angular core development team are building Angular 2 with TypeScript

Exploring the new .NET “dotnet” Command Line Interface: In Scott Hanselman’s thinking, it should be really easy to sit down and play with .NET from the command line, like you can with Node, and the early and promising work at https://github.com/dotnet/cli is moving in that direction. In this post, he introduces the dotnet CLI with some examples and how interesting the story becomes when you consider the native compilation piece of the story. Then you might start asking why other runtimes don’t have their own compile commands!

Functional C#? It’s an interesting question, because C# is very much an object-oriented language that supports functional programming styles, whereas F# is a functional language that supports object-oriented styles. In any case, Eric Lippert here follows up a talk he gave on functional programming in C# with some interesting Q&A on such matters, such as “Can you explain async and await in parallel programming?” Well, that’s the one question he doesn’t answer, so I didn’t give you any spoilers!

Daily .NET Tips: Perhaps the new year is a good time to go back to certain fundamental questions, like Why am I here? What is the meaning of life? What is the difference between Autos and Locals Window in Visual Studio? And, much to the irritation of Master Yoda and his famous quote, “Do or do not. There is no try!” we have questions like what is the difference between int.Parse() and int.TryParse()? Ahhijit Jana answers these questions on Daily .NET Tips, and also has a popular post covering 10 Visual Studio tips to improve your development productivity.

Difference between int.Parse and int.TryParse

.NET for UWP series on Channel 9: As a .NET developer, you’ll be familiar with how .NET works in Universal Windows Platform (UWP) apps on Windows 10, but you might not understand the subtle differences that are explained in this video series. Lucian Wischik kicks it off with a short overview of .NET Core (3m 8s), followed by Daniel Jacobson’s introduction to.NET Native (6m 35s), which is a simple yet effective way to increase app performance. He continues with .NET Native Advanced (8m 43s) with topics such as .NET Native debugging, serialization, reflection, and optimizing CI build servers. Lucian then concludes with his own set of advanced topics (16m 24s) including important details about packaging.

.NET Native

A project guide to UX design (PDF download): finally, for something a little different, this free guide from the GatherContent team explores the relationship between UX design and content strategy. It discusses user stories, designing content models, prototyping, and validation through iterative usability testing. Very insightful stuff!

Content Strategy: A guide for UX designers

Enjoy,

Kraig Brockschmidt, Senior Content Developer, Visual Studio
@kraigbro

Kraig has been around Microsoft since 1988, working in roles that always have to do with helping developers write great software. Currently he’s focused on developing content for cross-platform mobile app development with both Xamarin and Cordova. He writes for MSDN Magazine, is the author of Programming Windows Store Apps with HTML, CSS and JavaScript (two editions) and Inside OLE (two editions, if you remember those) from Microsoft Press, occasionally blogs on kraigbrockschmidt.com, and can be found lurking around a variety of developer conferences.

New and Noteworthy Visual Studio Extensions – Feburary 2016

$
0
0

Last month I showed you a few of my favorite Visual Studio extensions that give great examples of how developers add new features to Visual Studio. With such a vibrant ecosystem around Visual Studio, new extensions are added almost every day—in fact, over 135 new extensions have been added to the Visual Studio Gallery already in 2016!

To help you enjoy this creativity from the community, every month or two I’ll be introducing some of the new extensions that caught my eye. Here are the highlights for this month:

After this I’ll also list the top 10 new extensions for January and February. And of course, let me know in the comments if I missed a great new extension that you love. At the end of this post I’ll also point you to information on writing your own extension—who knows, maybe you’ll be featured here soon yourself!

UWP Tile Generator by Shen Chauhan

Download UWP Tile Generator from the Visual Studio Gallery

If you are a Universal Windows (UWP) app developer, you know that part of making your app shine is having the right tiles and icons for all the form factors across platforms. Creating these images manually can be time consuming and cumbersome, which is where the UWP Tile Generator comes in handy. It generates all required sizes of tiles for your app right in Visual Studio and integrates them into your app manifest. Definitely a time saver.

UWP Tile Generator extension

Open Bin Folder Extension by John McBridge

Download Open Bin Folder from the Visual Studio Gallery

The beauty of the Open Bin Folder extension lies in its simplicity: all it does is add an item to the Solution Explorer context menu that opens your project’s bin folder. It doesn’t sound like much, but is a definite time-saver for a somewhat frequent operation! As an added bonus, the source is available on GitHub, so if you’d like to see what a Visual Studio extension is made of, take a look.

Open Bin Folder extension

DocPreview by Olev Shilo

Download DocPreview from the Visual Studio Gallery

Do you document your code? I hope so ;) XML comments are a great way to do this as you go, especially because the XML tags are picked up by the Visual Studio IntelliSense making it easy for others to reuse your code. The DocPreview extension gives you a live HTML preview of your comments in a Tool Window, as you write it. This extension has been open-sourced.

DocPreview extension

JavaScript Snippet Pack by Mads Kristensen

Download the JavaScript Snippet Pack from the Visual Studio Gallery

The JavaScript Snippet Pack extension is a great example of using an extension to add a bunch of useful code Snippets to Visual Studio. The pack comes with over 30 snippets that will come in handy for every JavaScript developer, such as adding an event listener and for each loop. Mads made the source for this extension available on GitHub as well. And guess what?! One handy developer already ported it to Visual Studio Code. This is the power of open source software.

JavaScript Snippet Pack extension

Top 10 Popular Extensions from January/February 2016

As I mentioned in the beginning, we added a great number of new extensions in January and February. Out of the new ones added, here are the 10 most popular ones, three of which we’ve already seen—give them a try!

  1. JavaScript Snippet Pack
  2. Supercharger
  3. Ionic Pack
  4. SFML Template project
  5. UWP Tile Generator
  6. Dummy Text Generator
  7. Bootstrap Rifle
  8. UWP App Skeleton
  9. JSON ADO.NET Provider
  10. DocPreview

Build your own

These few examples of simple integrations show a wide range of what you can build through Visual Studio’s extensibility framework. If that piqued your interest, we just launched a new site with some great tutorials and videos on how to get started with Visual Studio extensions: VisualStudio.com/integrate. Take a look and let me know how it goes. I’m also hanging out in our extendvs Gitter chat as @bertique. Come on by and give me a shout.

Michael Dick

Michael Dick (@midi2dot0), Senior Program Manager, Visual Studio
Michael Dick is a Program Manager working on the Visual Studio team. Before joining Microsoft, Michael worked at a variety of tech companies and is passionate about developer tools. He is currently focusing on the ecosystem and extensibility experience for Visual Studio.

Visual Studio 2015 Update 2 RC

$
0
0

Today we released the next set of reliability and performance improvements in Visual Studio 2015 Update 2 RC, which also addresses issues that we hear from your continued feedback.

Building on what we announced with the CTP release, here’s what you’ll find in Update 2 RC:

  • Issues we’ve fixed:
    • Errors in the NuGet Package Manager Console that failed with “A task was canceled.”
    • Crashes due to null and/or invalid pointer reads.
    • Crashes some customers have encountered when opening a solution.
    • Reduced licensing failures and more actionable information when failures occur.
    • C++ projects load faster with improvements in UI delays.
    • Promotion of MSBuild warning MSB3644 (“The reference assemblies for framework {0} were not found”) to error status so incorrect target frameworks that give rise to this error will break a build.
    • Correction of problems in Visual Studio with ASP.NET after installing Update 2 CTP.
  • C/C++ runtime library performance: we’ve improved the performance of a number of common operations. For example, extracting floating point numbers with iostreams is up to nineteen times faster. Certain string operations are also faster, especially std::string::replace when replacing same-sized substrings. Give it a try and let us know if you notice a difference.

As with the CTP, we’ve continued to ship additional features as covered fully in the release notes, such as NuGet 3.4 and C#/Visual Basic refactoring to make methods synchronous. A couple of others include:

  • Visual Studio now shows Git SCC status in the status bar, and jumping to Changes, Sync, and Connect pages are just a single click away. This is all extensible by third party SCC providers.
  • Visual Studio now supports consuming TextMate snippets with IntelliSense completion by placing tmSnippet files into a snippet folder.
  • Improvements to the Application Insights search experience with the ability to jump to the code where a telemetry event was emitting, a search for related items, and a new experience to log data from apps.

Again, check the Description of Visual Studio 2015 Update 2 RC for all the details.

We’ve also released Team Foundation Server 2015 Update 2 RC 2 today. You can see what’s new there in the TFS Update 2 RC 2 release notes.

As always, we welcome your feedback. For problems, let us know via the Send Feedback option (Send a Smile) in Visual Studio. For suggestions, let us know through UserVoice.

John Montgomery

John Montgomery is the Director of Program Management for Visual Studio, responsible for product design and customer success for all of Visual Studio, C++, C#, VB, JavaScript, and .NET. John has been at Microsoft for 17 years, working in developer technologies the whole time. Reach him on Twitter @JohnMont

Microsoft joins the Eclipse Foundation and brings more tools to the community

$
0
0

At Microsoft, our developer mission is to deliver experiences that empower any developer, building any application, on any OS. And this mission requires us to be open, flexible, and interoperable: to meet developers and development teams where they are, and provide tools, services and platforms that help them take ideas into production.

This week, we’re attending EclipseCon to connect and advance our vision with the Eclipse community. We recognize the great work coming out of the Eclipse and Java developer community and appreciate that Eclipse developer tools are used by millions of developers worldwide. We have worked with the Eclipse Foundation for many years to improve the Java experience across our portfolio of application platform and development services, including Visual Studio Team Services and Microsoft Azure.

Today, I’m happy to share that Microsoft is taking its relationship with the Eclipse community to the next level by joining the Eclipse Foundation as a Solutions Member. Joining the Eclipse Foundation enables us to collaborate more closely with the Eclipse community, deliver a great set of tools and services for all development teams, and continuously improve our cloud services, SDKs and tools.

Microsoft delivers a number of Eclipse-based tools today. The Azure Toolkit for Eclipse and Java SDK for Azure enables Eclipse users to build cloud applications. And with the free Team Explorer Everywhere plugin, developers have access to the full suite of source control, team services, and DevOps capabilities of Visual Studio Team Services from within their IDE. These offerings will continue to be maintained and shared through the Eclipse Marketplace

Additionally, I was honored to join Tyler Jewell, of Codenvy, onstage today to announce new Azure and Visual Studio Team Services interoperability with Codenvy’s workspace automation tools, built on Eclipse Che. With Visual Studio Team Services, Azure, and Codenvy, software development teams can collaborate more easily than ever before. Codenvy’s new Visual Studio Team Services extension activates Codenvy workspaces on-demand from within Microsoft’s tools, creating a natural workflow that aligns with agile methodologies and principles. The Azure VM Marketplace now includes a virtual machine preconfigured with Codenvy, so developers can instantly provision private Codenvy workspaces on Azure.

We’re also announcing more tools and services specifically for Java and Eclipse developers that provide powerful development solutions and services that span platforms.

  • We are open sourcing the Team Explorer Everywhere Plugin for Eclipse on GitHub today, so we can develop it together with the Eclipse community.
  • Azure IoT Suite support in Kura. We will contribute an Azure IoT Hub Connector to Kura that will allow to easily connect gateways running Kura to Azure IoT Suite.
  • Azure Java WebApp support in the Azure Toolkit for Eclipse, which makes it easy to take a Java web app and have it running in Azure within seconds
  • A refreshed and updated Azure Java Dev Center
  • With the Java Tools Challenge, we are inviting Java developers to build apps and extensions for VSTS.

In addition to participating in the keynote, we will have a booth onsite and hold two sessions at the event. EclipseCon Sessions:

The Internet of Unexpected Things, by Olivier Bloch, Senior Program Manager, Azure IoT

Connecting to the cloud many different devices of various form factors, powered by eclectic platforms running apps developed in random languages to build an advanced end-to-end IoT solution seems (and often is) as complicated as this sentence is long… Let’s take a look at how it’s done with Azure IoT services, device SDKs and tools in a demo-heavy session for developers. From sensors to advanced analytics, you’ll discover how to take advantage of the open source SDKs and tools that make it easy to connect devices to capture and analyze untapped data as well as monitor and control your IoT infrastructure.

Integrating Different IDEs with a Common Set of Developer Services, Dave Staheli, Software Engineering Manager, Visual Studio Team Services

Modern applications require varied tools and languages to address multiple platforms and form factors. Often, different tools are used by teams to plan, code, build, track, test, deploy, and monitor. How can these activities be normalized to reduce team friction? This session details an approach Microsoft is taking to plugin development. By building plugins for different IDEs that integrate with a common set of team services, developers can use diverse tools to participate in the same team activities. We’ll share experiences in reusing code across plugins for different IDEs, give demos with Eclipse, IntelliJ, and Visual Studio, and discuss technologies on the brink of making this even easier.

Our announcements today further strengthen our investment in cross-platform development. And our membership in the Eclipse Foundation formally recognizes our to Eclipse and Java developers. We’re looking forward doing more with the Eclipse community going forward. If you have ideas or feedback, I’d encourage you to please share with us through our Visual Studio UserVoice Site.

Thank you!

Shanku Niyogi, General Manager, Visual Studio Team
@shankuniyogi

Shanku has been at Microsoft since 1998, and has spent most of that time on developer tools and runtimes. Shanku currently leads the Open Tools group, which is responsible for the new cross-platform Visual Studio Code product, Microsoft’s tools for Node.js, and a number of Microsoft’s other tools outside the Visual Studio IDE
Viewing all 1076 articles
Browse latest View live


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