Archive for the ‘Other’ Category

Peeking into NuGet packages with dotPeek

Tuesday, May 7th, 2013

Using dotPeek, we can peek into assemblies by downloading symbols or by decompiling them. Out of the box, we can also open NuGet packages stored locally. But what about NuGet packages that we haven’t downloaded yet? Well… there’s a plugin for that!

The plugin is available for download. Extract the ZIP file contents and run the appropriate batch file for your version of dotPeek, e.g. Install-NuPeek.1.0.bat for dotPeek 1.0, or Install-NuPeek.1.1.bat for dotPeek 1.1. The plugin is compatible with dotPeek 1.0 and the dotPeek 1.1 EAP. Source code for this plugin is available on GitHub.

After downloading and installing the plugin, dotPeek features a new toolbar icon as well as two new menu items under the File menu. The File | Open from NuGet… menu entry allows us to download and open a NuGet package from any NuGet repository out there. The File | Open NuGet packages.config… menu entry allows us to open all NuGet packages defined in a packages.config file.

dotPeek open from NuGet

Using the toolbar button, we can search for a NuGet package we want to load and decompile using dotPeek. We can download packages from the official NuGet gallery as well as any other NuGet repository out there such as your TeamCity server.

Select package from NuGet gallery

We can search for packages and open them. Using the Load dependencies checkbox, we can automatically download dependencies for the selected package as well. Once downloaded, dotPeek will display the NuGet package and download symbols or decompile contained assemblies.

dotPeek open NuGet package

In a future blog post, we’ll dive into how we can create plugins for dotPeek. If you can’t wait, the sources for this plugin are available on GitHub. In the meanwhile, download the dotPeek EAP and give it a go!

Code Formatting Improvements in ReSharper 7.1

Monday, November 12th, 2012

Code formatting is, and will always remain, a sensitive subject: with many companies having their own specific standards, it’s very difficult to please everyone. In ReSharper 7.1, we’ve taken another shot at smoothing out the formatting experience with more options and settings, many of which were requested by our customers.

Aligning Multiline Constructs

It has long been an issue that long method calls, whether it be in fluent interfaces or LINQ, resulted in code that looked less than agreeable. What we’ve done to remedy this is added two options to control the way long method calls are wrapped.

The first option is one to Wrap chained method calls:

The three supported options are as follows:

  • Chop always, as its name suggests, ensures that chain method calls are always split up on the period operator.
  • Simple wrap wraps method calls when the maximum line length has been reached. Multiple chained calls can appear on a single line.
  • Chop if long wraps method calls when the maximum line length of the call chain has been reached, with each of the calls appearing on a separate line.

ReSharper also has an option called Prefer wrap after “.” in method calls just in case you want parts of the chain to always end with the dot rather than start with one:

Whether or not the methods are actually aligned on the dot is controlled by yet another option under Other|Align Multiline Constructs called Chained method calls. Turning this off causes the wrapped line to be indented instead of dot-aligned:

XML and XML Comment Formatting

In ReSharper 7.1, XML formatting options have had a bit of a redesign. Also, we’ve given XML Doc Comments a separate category, so you can now control the two independently.

Broadly speaking, the formatting style of both ordinary XML and XML Doc Comments is supported via the following categories:

  • Line wrapping determines how XML entities are wrapped.
  • Processing instructions can also be formatted according to a set of rules.
  • Elements that are Inside of tag header (i.e., attributes and spacing between them) can also be controlled. For example, you can determine if there’s a space after the last attribute, or whether attributes on new lines are indented or not.
  • Tag content settings determine what happens to text that’s placed between various XML tags. You can control wrapping, line breaks and indentation.
  • Finally, settings for elements Around tags determine if and when tags get placed on a separate line. XML Doc Comments also have a setting that lets you specify tags that are always placed on a separate line regardless of the overall settings — handy if you want tags like <summary> to always occupy a separate line.

Wе’vе mаdе RеShаrреr асt а littlе lеss аggrеssivе with rеsресt tо yоur linе brеаks, choosing to respect them where it makes sense. If for some reason you prefer the old behavior, you will need to navigate to XML | Formatting Style in ReSharper’s options and:

  • Set the value in Tag content | Line breaks after header and before footer when tag is longer then to 20
  • Set the value the Attributes format to ‘On single line’ under both the Inside of tag header and Processing Instructions headings
  • Set the check box in Around tags | Place singleline tags on new line

Alignment and Indentation Improvements

Many users have corporate policies that are very strict with regard to tabs and spaces that are used for both indentation and alignment. To provide a better experience for our users, we have introduced two options that impact the way indentation is carried out:

The first of these options concerns indentation in multi-language files. You can have ReSharper use a global indentation setting for every type of additional language that’s being used in a multi-language file; or, alternatively, you can indent each language using its own settings as specified in ReSharper’s options under Code Editing | [Language] | Formatting Style.

The second setting concerns the uses of tabs. If the ‘Keep tabs’ option is selected under Visual Studio’s Options (under Text Editor | All Languages | Tabs), these settings determine how tabs are used for indentation and alignment. The options are as follows:

  • Use spaces — this tells ReSharper use tabs for indentation and spaces for alignment.
  • Use only tabs only uses tabs for alignment, which may cause misalignment in case a block of code does not fall on a tab boundary.
  • Mix tabs and spaces for optimal fill uses a combination of tabs and spaces for precisely aligning code.

Web Formatting Improvements

By popular demand, we have added a setting for ASP.NET and Razor projects, so you can use the K&R brace style in ASP.NET while continuing to use the BSD style in C#:

We’ve also added several options to the JavaScript formatter. Specifically, we’ve added options for specifying brace layout for functions passed as parameters into other functions, and have added an option to indent object literals, arrays and nested expressions. Additionally, we’ve introduced an option to add an empty space in braces inside an object expression.

Also, as previously mentioned, web languages can now elect whether or not to use the indentation settings of their parent file. This means that a block of C# code embedded in an HTML file can either use the C# settings or the HTML settings depending on the chosen option.

Odds and Ends

For all fans of the K&R brace style, we’ve added several new settings concerning the rules for inserting blank lines in code:

We’ve also added some options for specifying whether or not attributes should be placed on the same line as single- and multi-line property accessors:

And finally, we’ve put in extra work on proper splitting up of compound conditions in if, while and do statements:

It’s all you!

Most of the features described here have been implemented based on user feedback, for which we thank you! If there’s something else that you find missing, please let us now by posting your use case on our issue tracker.

If you’re impatient to try out these and other improvements, download ReSharper 7.1 nightly builds.

dotTrace SDK: An API for Your Performance Needs!

Thursday, August 9th, 2012

As of version 5 of dotTrace Performance we started shipping as part of the package, an SDK which allowed us to programmatically make use of dotTrace Performance engine. We are excited to announce that we are now offering this as its own standalone product, with its own installer, and available for free. Download it here.

Making performance snapshots child’s play

Performance issues generally are a pain. They usually only appear in production and are hard to pinpoint and even worse to reproduce. When performance issues arise, the first step is to run analysis on the application to try and find the bottlenecks, and this isn’t always easy in production. To begin with, we need to interact with the machine where the application is running. With dotTrace Performance we’ve made this somewhat easier by allowing remote profiling. Secondly however, we need to have some knowledge to collect this information, in other words, know how to work with dotTrace Performance. This usually means a member of the support team or developer. Not the customer.

Wouldn’t it be great however if this weren’t necessary? Imagine if we could just instruct the program to profile itself. Well that is what the SDK is bringing to the table, and more!

Scenarios

Let’s take a look at some of the scenarios that the SDK enables.

Self-Profiling

As mentioned previously, one of the great advantages of the SDK is to allow an application to profile itself and gather performance metrics. In ReSharper 7 we are already making use of this functionality. When you install ReSharper, you will notice a new menu entry under Help menu:

ReSharperHelpMenu

When we execute this option, the dotTrace performance engine kicks in and attaches itself to the running process. It then starts to gather information about everything that is going on in the application. Once enough information has been gathered, it creates a snapshot file that can be analyzed by dotTrace Performance and more importantly, it can be detached from the process. As we know, running an application under a profiler has a performance penalty so it is fundamental to only do it for the minimum time required.

By default, when invoking this functionality, the dotTrace Controller pops up:

dotTraceController

However, this functionality can be customized to one’s own needs, so we can in fact have something that blends in more with our application and we also have access to events that allow us to intercept the snapshot and do what we want with it.

Application-Centric Profiling: Profiler API

When analyzing performance snapshots, we usually focus on our own application code and ignore system code such as the BCL calls or libraries and frameworks that we cannot necessarily do anything about. With some applications this is easy to accomplish as dotTrace Performance grays out irrelevant code and allows us to focus on our own. However with certain types of applications, it’s not always straightforward as it’s hard to often distinguish entry points from the users perspective.

The SDK now allows us to indicate where we want to focus our performance analysis by allowing us to define entry points. For instance, in an ASP.NET WebForm application, we can add the following code to the Application_Start event:

CodeSnippet

This means that if we’re running under dotTrace Performance (in other words profiling the application), to start monitoring our code. We can then indicate where we want to stop monitoring also:

CodeSnippet

and thus allowing the focus to stay within the bounds of the code we are interested in. Notice how we do not have to make explicit calls to the profiler. We just indicate when we want to start and when we want to finish.

By doing this, we can now activate the Use Profiler API checkbox in dotTrace Performance

dotTraceConfig

and thus removing all irrelevant infrastructure code that we are not interested in from the analysis.

On-Demand Profiling

Although not a scenario as such, the ability to pause and resume performance, gives us the ability to provide on-demand profiling in our applications. We can have SDK calls in the code and activate them on demand.

Getting Started: Show me the code

Once we download and install the SDK, the application folder where it is installed contains 4 folders:

Folders

The Doc contains the documentation for the API classes which we’ll examine briefly in a moment. The Lib folder is the two assemblies that are referenced in applications that use the SDK. An important folder is the Redist. This contains a redistributable copy of the dotTrace Performance engine which should be shipped with your application if you’re using the Self-Attach functionality. Finally Samples provides two documented samples of how to work with the SDK in the scenarios depicted previously. One of them is the VSTool Visual Studio self-profiling add-in and the other is an ASP.NET WebForms application.

The SDK itself has a small surface area, with only a few classes. Namely the important ones include:

  • ProfilingControl: Class to control the starting, stopping, pausing, attaching and detaching of the profiler to the application. We need this class in order to use the Use Profiler API option in dotTrace. An example usage of this is the ASP.NET WebForms sample that ships with the SDK.
  • SelfAttach: Class to allow self-profiling. Covered in the VS add-on sample that ships with the SDK.

When using the SelfAttach class, we can indicate how we want the behavior to be once a snapshot has been taken. We can opt on opening the snapshot file, saving it or have it processed by a third party assembly. Each of these options have their own settings and are defined by different classes:

  • OpenProfilingConfig: Open the snapshot once completed
  • SaveProfilingConfig: Save the snapshot once completed
  • ProcessSnapshotProfilingConfig: Process the snapshot once completed

We pass as constructor to argument to SelfAttach an instance of one of these classes. The VSTool demo shows example usages of all three.

An important option among the configuration classes is the ProfilerControlKind property which indicates how the profiling process is controller. The default option (as described above in the Self-Profiling) is to use the dotTrace Controller window. Alternatives are None or using the API.

Summary

This is the first big release of the SDK and based on the feedback we receive we want to improve it and make it more versatile, so we appreciate any and all comments. As mentioned the SDK is freely available. You do not need to own a license of dotTrace Performance to distribute it. You do however of course need dotTrace to analyze the results. The point is though to make it simple and cheap for you to include this functionality inside your applications

You can download the SDK from here.

Enjoy and please give us any feedback.

Happy Halloween!

Tuesday, November 1st, 2011

Thank you Curtis!

Streamlining Issue Management with GitHub and YouTrack

Monday, October 24th, 2011

The Typical Developer Workflow

image

* Thanks to @gregyoung for enriching me with whatthecommit.com

In general, as developers we hate uninteresting tasks such as managing issues, so the less time and effort we spend in tracking bugs and features the better. The worse case scenario is the one outlined in the previous workflow, i.e. work on a bug, comment the fix in source control and then separately manage the issue in an issue tracker. Ideally, we’d like to only have to indicate what we’ve worked on and how it’s related to a check-in once! And fortunately with YouTrack, we can. However, YouTrack goes one step further. It actually allows us to control issues from our source control. Let’s see how this plays out when it comes to using GitHub.

In essence we have two options when it comes to integration GitHub:

  • Directly via GitHub Service Hooks.
  • Use TeamCity as the gateway, which in itself offers other advantages (opening it up to other VCS’s too).

We’ll cover each of these in detail.

YouTrack and GitHub Service Hooks

Earlier this year, GitHub provided official support for YouTrack hooks, allowing for tight integration between the two systems. This makes it extremely easy to set up YouTrack for issue management.

Assuming we have a project already set up on YouTrack and GitHub:

1.  Click on the project in GitHub and select Admin

2. Select the Service Hooks from the left-hand side menu

image

3. At the very bottom of the list of Service Hooks, select YouTrack

image

4. Enter the following information in the form provided

image

A few things to note here:

  • Base Url is the url of your YouTrack server, which is independent of the actual project.
  • Committers is the group in YouTrack that has permission to commit to source code for the particular.
  • Username should be a user on YouTrack with Server Admin rights [In an upcoming release this will change to only require Project Admin rights].

5. Switching over to the YouTrack side, the only thing required is the to create the Committers group and add the correct users to it. This step isn’t required but it’s good practice to limit the users that can update an issue to those associated with the project.

6. A last important step (which is performed once only)  is to make sure the REST interface is activated on YouTrack (via the Administration Settings)

image

Putting it to work – Hello YouTrack Commands

Now that we have the two systems linked up, how do we actually get this to work? If you’re not familiar with YouTrack, you might not know about an amazing feature it has called commands.

When most people look at YouTrack, all the see is just another web application with links to click on. However, the true power of YouTrack is in it’s support for commands, which is basically a way of sending it different pieces of text that it understands. This is normally done using the Invoke Command window (Alt+Ctrl+J…yes YouTrack is VERY keyboard friendly):

image

We start typing text and YouTrack offers us completion and tries to figure out what we’re trying to do. It’s smart enough that it doesn’t need us to spell things out, i.e. instead of having to type “state: fixed assignee: hhariri”, we can just type “fixed hhariri” and it figures out the rest:

image

It even remembers recent commands we’ve applied to offer the same combinations to us on the next input.

Now if we take this concept of commands and combine that with the usually useless commit messages we can actually come up with something useful! We can use the commit messages to send YouTrack commands (in fact, with YouTrackSharp I’ve started implementing PowerShell commandlets to allow console support for YouTrack too). As such, from our console our Git GUI we can do the following:

image

What we’ve done here is provide a command as commit message. We’ve identified the issue we’re going to apply the command to (issue Id prefixed with #) and followed it by the command Fixed.

Once we do this and push it to GitHub, the Service Hooks in GitHub will now supply this information to YouTrack, which in turn parses the command and applies it to the issue:

image

Notice a few things here:

  • The issue’s history has been updated with the date/time it was resolved along with a comment saying it was emitted via commit by hhariri.
  • The issue has been actually marked as Fixed.
  • The Username is clickable. It has correctly identified the username that checked in and mapped that to the YouTrack user. How does it do know that? Simple. It’s based on the email address. That’s why it’s important to have the correct email address associated with both account.

Multiple Issues

YouTrack also supports multiple issues being updated via the commit message. In order to do this via the commit message, each issue should be on it’s own line (i.e. when using the console, don’t provide the –m option with the commit and have Git prompt you with an editor to input comments).

Also it is important to note that the commit messages are not limited to just the “Fixed” command, but other commands can also be added such as tagging an issue, etc. (comments currently is not supported).

Integrating GitHub (or any VCS) with YouTrack via TeamCity

The second option for integration between YouTrack and GitHub is using TeamCity as the gateway. The advantage to this mechanism (apart from using TeamCity!) is that it now opens the door to more VCS options, including Subersion, Perforce, Git, Hg and all VCS’s that TeamCity supports.

The steps to integrate YouTrack and TeamCity are pretty straightforward:

1. Click on YouTrack Administration and select TeamCity Integration

image

2. Select to Enable TeamCity Integration and click on the Add TeamCity Server link

image

Enter the information as described in the dialog box and click Save.

3. Once the server is set up, we now need to define the mappings between TeamCity and YouTrack projects. For that, we click on the define mapping link:

image

We need to define pretty much all the values in the dialog box (which are self-descriptive).

In addition to the minimum required settings, we can also define restrictions on which groups have access to viewing issues via the Permissions tab, as well define a default command to be set on issues affected by failed builds:

image

4. In order to get the User Mapping, YouTrack like before uses the Email address. As such, we need to make sure that our VCS is configured to map to email. This is done on the TeamCity side under My Settings and Tools which is located under the Username menu [Note we have now switched to TeamCity]:

image

We edit the corresponding settings and set the Git roots to use email:

image

5. That’s all that is needed in order to get VCS commands working via TeamCity acting as gateway. This will now provide us information and output like the following in YouTrack when sending a fixed command via a commit message:

image

With this, a new Tab appears on YouTrack named TeamCity which contains information about the commit being made along with a link to the username.

We could in essence stop right here. The next step however is to go full force and get some of the added benefits of integrating TeamCity and YouTrack, this time from TeamCity’s side.

6. Under TeamCity Adminsitration click on Server Configuration and then on the Issue Tracker tab

image

7. We now need to create a new connection by clicking on Create New Connection, and entering the following information:

image

Once we test the connection we can click Create and we’re done. From this point on, we can click on Changes and have drill-down information on issues, link directly to them, etc.

Summary

As we can see, there are two ways to integrate YouTrack and TeamCity. The former requires a little bit less of a setup but is restricted to GitHub (currently). The latter gives us the full benefit of having a tight integration between TeamCity and YouTrack and opens up the door to using any VCS that TeamCity supports.

Most importantly however, the purpose of all this is to streamline the process, making issue management simple, non-intrusive and easy to work with.

[Note: If you’re an OSS project lead, note that TeamCity and YouTrack Integration are already setup on Codebetter.com. Ping me if you need help setting up your project details to take advantage of what’s been explained here].

The JetBrains Magical Mouseless Continuous England User Group Tour

Tuesday, October 18th, 2011

After months of preparations and in collaboration with  NxtGen User Groups, VBug and Anteo, we are happy to announce the upcoming JetBrains User group Tour of England: 5 Days, 5 Cities, finishing it off in London in style!

The Tour Dates

  • Monday 14th Nov - Essex
  • Tuesday 15th Nov - Cambridge
  • Wednesday 16th Nov - Manchester
  • Thursday 17th Nov - Coventry
  • Friday 18th Nov - London

(For more information and Registration, see below)

The Agenda for Essex, Cambridge, Manchester and Coventry

Mouseless Driven Development

Do you know ReSharper, are using it or have used it in the past? Do you think you are getting the full potential out of it? Even developers that have been using it for several years often only scratch the surface. Come and learn all the tips and tricks of ReSharper and see how to use it to it’s full potential to truly create a mouse less driven development environment.

The Agenda for London

The London event will be slightly longer, but will be compensated with Food and Beer!

Mouseless Driven Development

Do you know ReSharper, are using it or have used it in the past? Do you think you are getting the full potential out of it? Even developers that have been using it for several years often only scratch the surface. Come and learn all the tips and tricks of ReSharper and see how to use it to it’s full potential to truly create a mouse less driven development environment.

Continous Delivery

Paul Stack joins us to talk about Continuous Delivery and how to use TeamCity for this purpose:

Continuous Delivery is all about allow features to be delivered in a more timely and reliable fashion. In this session, Paul will introduce the concepts of continuous delivery, through continuous integration;  automation of builds, test and deployment process, version control techniques for Continuous Delivery, Pitfalls, Objections and Obstacles.

Sebastian Lambla will show us to to twist Visual Studio and ReSharper to provide dynamic plug-in functionality with OpenWrap.

Registration

If you are going to attend the London meeting, please use our EventBrite page to sign up. If you are going to attend one of the other meetings across England, please use the corresponding link below to register directly with the user group.

(In London we will be providing Food and Drinks, so please make sure that you sign up ahead of time. Places unfortunately are limited to approximately 70 people!)

Scotland

Unfortunately, despite our initial intentions of also including Scotland in the tour, we were not able to due to scheduling. However, we hopefully do plan to repeat the tour with Scottish User Groups in the New Year so please stay tuned!

Thank you!

A big Thank You to the Coordinators of NxtGen User Group, VBug and Anteo for their efforts in organizing this tour and collaborating with us in all possible ways.

Free upgrade to ReSharper 6 starts today + decompiler gets a name

Tuesday, April 26th, 2011

Some great news today in the .NET tools department!

First of all, any ReSharper 5 new or upgrade purchases made since today, April 26, 2011, qualify for a free upgrade to ReSharper 6!.

That means, if you or your employer are using ReSharper 4.x or earlier, or if you’re just considering buying ReSharper, now is the perfect time since your new license will work both in the current ReSharper 5 and the upcoming ReSharper 6.

Important update! If you have purchased ReSharper 5 within a month back from the date of free upgrade announcement, please contact JetBrains sales for a significant upgrade discount.

Second, we have picked a name for our new .NET decompiler from the list of awesome suggestions that we received on facebook. The tool is now called dotPeek! Thanks everyone for your suggestions, and we have four lucky winners.

Name for .NET decompiler anyone?

Wednesday, April 20th, 2011

We’ve got a cool brainstorming session underway! You can take part, too: just go to JetBrains Facebook page and suggest a name for the upcoming free .NET decompiler from JetBrains.

Free personal licenses to any 5 JetBrains tools and a cool T-shirt will be yours if we choose the name that you suggested.

Please only leave your suggestions on Facebook.

Use Alt+Enter in Microsoft Word for spell checking quick-fixes

Tuesday, April 19th, 2011

Sometimes we receive feedback on the most popular ReSharper keyboard shortcut, Alt+Enter, not being available outside of Visual Studio. This is a bit confusing for ReSharper users working in Microsoft Word where spell-checking comes with a curly underline for grammar and spelling errors in document — similar to how ReSharper highlights errors and warnings in Visual Studio. Proofing suggestions in Word are by default applied with a right mouse click or an unfamiliar shortcut, which kind of slows down document editing for ReSharper (or IntelliJ IDEA) users.

Here are some easy steps to make the renowned Alt+Enter shortcut to apply “quick-fixes” as well as navigate between errors in Microsoft Word documents. The following guide is based on Microsoft Word 2010; however, the steps are very similar in previous versions (for example, Word 2007 or 2003).

  1. Open the Word Options dialog box by choosing File | Options (Word 2007: Office button | Word Options.)
  2. Click Customize Ribbon (Word 2007: Customize.)
  3. Click Customize in the Keyboard shortcuts area (in Word 2003, the button can be reached by selecting Tools | Customize | Commands.)
    File | Options | Customize Ribbon dialog, Customize button
  4. In All Commands category, find a command called NextMisspelling. It is mapped to Alt+F7 by default.
  5. In the Press new shortcut key field, press Alt+Enter (it will be displayed as Alt+Return in the dialog):
    The Next Misspelling command, which needs to be remapped
  6. Click Assign, and you’re done!

Now gently close all dialogs and enjoy Alt+Enter displaying the spelling correction menu in Microsoft Word! Note that you can even press it anywhere in a Word document (not necessarily directly on a curly underline) to navigate to the next spelling or grammar error, and open the correction menu upon it:

Tales from QA: The “Re-Design” of the Dialog Box

Tuesday, February 1st, 2011

0_53699_50f6409b_orig

by @Asia_Rudenko