Jun
4
2010

Build .NET projects from Windows Explorer using MSBuild Launch Pad (mPad)

In September 2009 I posted about a tool I am using to build my MSBuild projects from the shell “Build your .NET project with a right click in Windows Explorer

Last week I changed to MSBuild Launch Pad (mPad) which also add a context menu when you right click your project or solution files.

The added value for me is that it maintained project, 1.0 was released on May 21, 2010 with following release notes:

    • Support sln, csproj, vbproj, vcxproj, shfbproj, ccproj, oxygene and proj files execution.
    • Basic settings such as Show Prompt, and Auto Hide are provided.
    • MSBuild Shell Extension integration is achieved.

I also very much like that when I right click and say build I get the control on the .NET framework version I want to use and if it is a Release, Debug or what so ever.

4668737460_d5f6fd3791_o[1]

Nice little productivity booster tool.

Apr
17
2009
Tools // WPF

Memory leak with WPF resources

I am working for a couple of months now with WPF and MVVM on an a business application using .NET Framework 3.5 SP1. Lately I faced a memory leak. Not the easy kind of memory leak with events handlers which keeps objects and its element tree alive, as explained here.

No it was something else ! I searched in our code for quite some time without finding anything.

My internet research brought me to a blog post from Ramon de Klein, “Memory leak with WPF resources (in rare cases)” which stated :

When does the problem occur?
The problem occurs in the following situation:

  1. A style is defined in the application’s ResourceDictionary.
  2. The style uses a control template that uses media effects (i.e. DropShadowEffect).
  3. The media effect should be referenced using a StaticResource.

We were matching the two first points and I tried the proposed fix:

You can force the effect to be frozen by specifying “PresentationOptions:Freeze=True”, but this is not common behavior.

The workaround is simple… Just add the Freeze attribute to all the effects that you don’t plan to modify at runtime.

But that didn’t made it.

I decided then to move the style definition from the application ResourceDictionary to the MainWindowView ResourceDictionary, which was for sure a better place for it. This to avoid the first point.

This worked! And we do not have this memory leak anymore. But as always when you fix one, some other popped up! But that’s another story.

How did I came to find the blog post from Ramon de Klein ?

With a perfect timing I got an offer from Red Gate to test their latest tool still in Early Access Program: ANTS Memory Profiler 5

You might watch a two parts video here (part1) and here (part2) and read about it here. You can even download a version from their forum, check it out.

First I used ANTS Memory Profiler 5 Timeline to see that the memory wasn’t released at certain points in which it should. The red line shows the Bytes in all Heaps and should go down after each vertical line (gray, blue and red)

Same result with Process Explorer, Memory usage going up without going down.

So we got on the screen the memory leak. Next step was to identify it.

Using Memory Profiler Class List, I browsed to the class that I new should be released, and proved it wasn’t: Live Instances is 3 and Instance Diff is +2. So at that time I knew that this class was maintained by something in memory.

Watching the Memory Profiler Instance list, I could identity the different instances still in Memory and one wasn’t new, so a good candidate to look at:

Finally switching to the Memory Profiler Object Retention Graph, I could navigate up the graph to see that DropShadowEffect was maintaining a reference:

Up to my application RessourceDictionnary, as exaplained in point 1 from Ramon de Klein blog post, as you can see.

All those information gave me the opportunity to find the blog post from Ramon and led me to the solution.

This is the result of the fix I implemented, as you can see I have now only one Live Instance of the ProductViewModel class and an Instance Diff of –1. This shows that the object wasn’t retained in memory and cleaned correctly.

 

ANTS Memory Profiler 5 and Ramon de KleinMemory leak with WPF resources (in rare cases)” blog post was of great help to fix this memory leak. Thanks!

Thanks flies also to Stephen Chambers for the support with my questions on ANTS Memory Profiler 5.

Finally I would like to warmly THANKS Laurent Bugnion for his kind chats that helped a lot, as always!

Apr
10
2009

ReSharper 4.5 released

As you might have realized following my blog, I am big fan of JetBrains ReSharper for quite some years! This tool really boost my productivity. Today they just realized ReSharper 4.5 which brings some new functionalities but also a huge improvement in performance.

What's New in ReSharper 4.5

ReSharper 4.5 delivers a great performance boost, new features and more. Read about them below or watch this Live Demo

Performance and Memory Usage Improvements

ReSharper loads and works faster and more smoothly in general, particularly on big solutions: now it takes 20 to 40 percent less time until the solution is ready for code editing. Website loading time has been reduced by 30%. Other accelerated operations include: renaming symbols, finding commonly used symbols, creating symbols from usage, and analyzing large XAML files. Memory requirements for analysis of jumbo autogenerated code files have been reduced. Read more »

Solution-Wide Code Inspections

To detect unused non-private members on the fly, we have improved our solution-wide analysis by introducing a set of specialized code inspections. They only work when you let ReSharper analyze your whole solution and help you discover: unused non-private declarations; unused return values of non-private methods; unaccessed non-private fields; unused parameters in non-private members; and more. Read more »

VB9 Support

Visual Basic .NET developers can now benefit from VB9 language support that includes implicitly typed local variables, object initializers, anonymous types, extension methods, lambda expressions, partial methods, and embedded XML. VB9 support is all around you, courtesy of new context actions, code completion, refactorings, and Parameter Info, among other supporting features. Read more »

Extended Naming Style Configuration

You can now define custom naming style settings for different languages and symbols including types, namespaces, interfaces, parameters, method properties and events, static and instance fields etc. Use them to precisely align the way ReSharper completes and generates code with your specific coding guidelines. Read more »

Other Enhancements

Go to Implementation — Jump from usage of a base type or member straight to any of its end implementations.
New and Improved Refactorings — Added Inline Field and refactored many other refactorings for greater performance.

Native MSTest Support — Finally provided natively in ReSharper on par with nUnit support.
Wider Cross-Language Capabilities — More efficient quick-fixes and context actions in many cross-language scenarios, as well as increased coverage for XAML and ASP.NET.
Smoother Language and Framework Support — Improved compatibility with F#, Compact Framework, Silverlight 2 and other languages and tools. Read more »

Download ReSharper

Jun
13
2008

ReSharper 4.0 with C# 3.0 support, JetBrains releases the ultimate Visual Studio plugin

JetBrains has released their ultimate Visual Studio plugin, ReSharper 4.0.

This much-anticipated productivity tool includes many new features and improvements.

It supports C# 3.0 and LINQ, plugs nicely into Visual Studio 2008 and 2005 and also support VB.NET.

It includes:

  • Full Support for C# 3.0 and LINQ; Full Edition and C# Edition provide comprehensive support for C# 3.0, including LINQ, implicitly typed locals and arrays, extension methods, automatic properties, lambda expressions, object & collection initializers, anonymous types, expression trees, and partial methods
  • Comprehensive Insight into .NET Framework
  • Solution-Wide Analysis, which looks for erroneous C# code in your whole solution on-the-fly, without compiling it first
  • Code Cleanup, flexible code compliance and formatting tool bringing together a dozen of ReSharper features. In addition to fine-tuning formatting style to use, you can opt to arrange 'this' qualifier, remove code redundancies, convert properties with backup fields to auto-properties, make fields read-only if possible, optimize using directives, shorten qualified references, update file header, replace explicit types with vars, and revamp your C# code with many more settings
  • New Refactorings
    • Convert Static to Extension Method
    • Convert Extension Method to Plain Static
    • Convert Property to Auto-Property
    • Convert Anonymous to Named Type
    • Inline Method
    • Convert Method to Indexer (to Default Property in VB.NET)
    • Convert Indexer (Default Property in VB.NET) to Method
  • Multiple New Productivity Features
    • Complete statement; inserts necessary syntax elements (braces, semicolons etc.) and gets you to the position to start the next statement, saving you from excessive juggling with the caret.
    • CamelHumps in Code Completion, allowing you to complete any symbol by entering only its uppercase characters.
    • Live Templates Editor & Manager, rejuvenated set of user interface items for viewing, managing, and editing all three types of templates — Live Templates, Surround With Templates, and File Templates.
    • Recent Edits, drop-down list similar to existing Go To features that shows files and symbols that you recently modified.
  • Smoother Interaction with Visual Studio Ecosystem
  • ASP.NET Speedup; significantly speed-up the analysis of ASP.NET pages 

You might read more details about all new features or the full list of features.

I recommend printing the keyboards shortcuts available in ReSharper 2.x / IDEA scheme and Visual Studio scheme.

You might also be interested by all the ReSharper’s plugins available: Gallio, RGreatEx, Agent Smith 1.1.8, Agent Johnson, ARP Another ReSharper Plugin, NHibernate Plugin 1.0, NSpecify, Scout plugin, xUnit.net 1.0

Finally you can download a free 30-day trial version of ReSharper 4.0. Go download it, it is just a must (at least for me and some others ;)!

May
20
2008

JetBrains ReSharper 4.0 EAP - First Beta Candidate released

JetBrains just released a First Candidate release of ReSharper 4.0 marked as Stable!

Date Build # Links Status Comment Known problems Fixed issues
19 May 2008 804 Download Beta Candidate Stable None Fixes
You might read more about this version 4.0 on the ReSharper 4.0 EAP Notes

I am using the 4.0 EAP for quite some time and I am really happy with it! In fact I just can't work without ReSharper!

Apr
22
2008

VisualSVN 1.4 released

VisualSVN, the plugin for Subversion in Visual Studio 2003, 2005 & 2008 was just updated with some new good features:

New Features
  • Quick Diff

    Quick Diff 
    Reviewing changes has never been so easy. Now you don't have to open separate diff window and remember locations of edited code blocks. VisualSVN marks in real-time the text lines changed since original version of the file and offers convenient navigation between them.
    Instead of pressing Page Up/Page Down several times and looking for changes just press Ctrl+Shift+Up/Down and jump to the next change immediatelly.

  • Toolbar

    Toolbar
    You don't need to remember curent code branch you are working on. There is current repository URL displayed on the VisualSVN toolbar and you can easily switch to another code branch from there. Buttons for the most common Subversion commands also make the life a bit easier.

  • Add Solution Wizard
    Add Solution

    First steps in using VisualSVN might have been non-trivial if you are not a Subversion expert. But with the brand new "Add Solution to Subversion" wizard it's just a piece of cake. The wizard automatically detects all potential problems and makes everything simple and intuitive.

  • Improvements and Bugfixes

    This release contains many stability fixes and improvements (eg. command-line tools included by default, digitally signed istallation package and more). For full list of changes please read VisualSVN changelog.

Upgrading from VisualSVN 1.3.x

The upgrade to VisualSVN 1.4 is free for all licensed users of VisualSVN. No need to uninstall previous version - simple install new one on top of it.

Download

Follow to the download page to get VisualSVN 1.4 and enjoy new level of productivity!

Mar
30
2008

VisualSVN Server 1.1 released

By starting to write a post about the new step achieved in the tooling of Tech Head Brothers development I just realized that VisualSVN Server 1.1 is released.

So I downloaded and updated my installation in 2-3 minutes, all went well, just nice.

VisualSVN Server Change Log

Version 1.1 (March 24, 2008) [Release Notes] [Download]
  • Added support for authentication via Windows domain.
  • Implemented VisualSVN Server dashboard.
  • It is now possible to edit server configuration via management console, without reinstallation.
  • Implemented "Import Existing Repository" command.
  • New user-defined configuration file named httpd-custom.conf has been added.
  • URL of the selected node is now displayed in the description bar.
  • New toolbar for the "VisualSVN Server" node has been added.
  • VisualSVN Server now will always use hostname as "server name".
  • VisualSVN Server will now suggest to subscribe to our news channel during installation.
  • "Copy URL" and "Browse" commands will now issue a warning if there are no users defined.
  • Warn user if the port we use is occupied by another service.
  • "Create Repository" command has been renamed to "Create New Repository".
  • "Copy URL" command has been renamed to "Copy URL to Clipboard".
  • Fix: File C:\.rnd was being created during installation.
  • Fix: VisualSVN Server couldn't be installed if there was no "C:\" drive in the system.
Mar
27
2008

Integration of VisualSVN (TortoiseSVN) and JIRA

The aim is to be able to associate a bug/feature described into JIRA to source code changes made into the Subversion repository.

First of all you need to install the JIRA Subversion Plugin on you JIRA server.

Then you need to have VisualSVN installed and configured with your project checkout and opened in Visual Studio. You might do the same directly with TortoiseSVN.

Right click on your solution in solution explorer and choose VisualSVN /properties:

Add then two properties bugtraq:url and bugtraq:message as here:

Now when you commit your code to Subversion using VisualSVN or TortoiseSVN you will get access to the textbox Bug-ID/Issue-Nr:

And in JIRA you will see linked to your bug/feature the Subversion commits associated to it:

A very nice feature to have in a development process!

Mar
7
2008

Indexing and searching business entities using Lucene.Net Framework, part 3

Conception using generics and reflection of a search engine to index and search content in your business entities without being intrusive.

Part 1 and 2 are available following those links

  1. Indexing and searching business entities using Lucene.Net Framework, part 1
  2. Indexing and searching business entities using Lucene.Net Framework, part 2

Solution’s architecture

The main idea is to be able to define the business entity’s properties that must be indexed when this one is saved or updated in the chosen persistence system.

With the goal to be the less intrusive possible in our model we come fast to the idea that we need to extend our business entities with meta-data. The issue then is that at runtime it is needed to know which meta-data needs to searched in the entity in order to be able to index the content of the decorated property.

As one of the goal is to have a Framework which manage the indexation and the searching of whatever business entity, we might have wrote a simple class inheriting from System.Attribute in an assembly separated from our domain. That would have the drawback of behind much intrusive in our domain. Another solution was needed.

As we have seen the developed Framework needs to know the meta-data, giving it the opportunity to index the content of the property at runtime. This means that at development time it is absolutely possible to generalize this information by using the generics of the .NET Framework 2. As we are talking about meta-data the only imposed thing is that our class inherits from System.Attribute.

The choice was made then to define a utility class in the domain assembly inheriting from System.Attribute which will serve us as a decorator of the entity’s properties needing to be indexed.

On the following picture you can see an example of the domain for an application to which we have added our attribute SearchableAttribute used to decorate the Post and Page classes:

The Visual Studio solution is organized as a Domain Driven Development solution:

We have so defined the new attribute SearchableAttribute in the assembly innoveo.Blog.Domain.

Here is the description of the organization of our solution:

  • innoveo.Blog.DAL: Data access layer using Euss OR/M mapping tool
  • innoveo.Blog.Domain: Assembly containing our domain business entities
  • innoveo.Blog.Services: Layer exposing the different business services
  • innoveo.Blog.Web: Web presentation & web services layer
  • Blog: The web application

Here it is for our solution that will use our business entities indexing Framework. Let’s have a closer look now at the Framework itself!

Indexing Framework

First here is the class diagram:

The role of each class of our Framework is as following:

  • EntityIndexer manage an index and index the business entities
  • EntitySearcher let you search business entities
  • EntityDocument is used by the class EntityIndexer in order to manage Lucene.Net Document
  • IndexPath is an utility class used to specify the location of index

As you can see on the diagram we use the .NET Frameworks 2 generics this in order to allow us to search whatever attribute decorating our business entities. But also to be able to have a Framework that is not dependant of any entities. This brings a good flexibility at the usage time as it let you index whatever property of type string of whatever business entity. All of this is without being intrusive in our model.

Now that we know about the architecture of our Framework it is time to look deeper in the details of the implementation.

This post is cross-posted on innoveo blog and in French on my .NET community portal Tech Head Brothers.

Mar
7
2008

Indexing and searching business entities using Lucene.Net Framework, part 2

Conception using generics and reflection of a search engine to index and search content in your business entities without being intrusive.

Part 1 is available following this link Indexing and searching business entities using Lucene.Net Framework, part 1

Lucene.Net presentation

Lucene.Net is an open source project coming from the Java world currently incubating at the Apache Software Foundation (ASF). It is a source code port on the .NET platform using C#, done class-by-class, API-per-API, of the indexing and searching engine algorithms of Java Lucene.

Apache Lucene is an efficient indexing and searching engine for text data. However it is not offering integrated support for document like Office Word or PDF, you need to use extensions able to extract the text content of a document in order to be able index it. This is also mandatory for markup documents like HTML.

Lucene.Net follows scrupulously the APIs defined in the classes of the original Lucene Java version. The API names as well as the class names are preserved with the intention to follow naming guidelines of the C# language. For example, the method Hits.length() of the Java implementation is written Hits.Length() in its C# version.

Like the port of the APIs and the classes in C#, the algorithm of the Java version of Lucene is also ported in the C# version. This means that an index created using the Java version of Lucene is 100% compatible with it C# version, in reading, writing and updating. Therefore two processes, one written in Java and the other in C#, could achieve concurrent searches using the same index.

You might consult the documentation of the last stable version, version 2.0, on the following page. To download the last stable version browse to this page. To get more information about Lucene I recommend using the pages dedicated to the Java version of Lucene which are much more consistent.

Lucene.Net Architecture

Lucene.Net Architecture

The lower layer is the data access layer (Storage). Then, the upper layer is about accessing the index files (data access). This layer is used by the indexing system and the searching system. On top of those we find a layer for searching and a search request parser layer used by the searching part of Lucene.Net. Identically we found a parser layer and a document layer used for the indexation part of Lucene.Net.

To get more information about Lucene I recommend reading the presentation on Lucene website.

Now that we got a better view on what is Lucene.Net about we will see in the next part how we will use it to index the properties of our business entities.

This post is cross-posted on innoveo blog and in French on my .NET community portal Tech Head Brothers.

About Laurent

Laurent Kempé

Laurent Kempé is the editor, founder, and primary contributor of Tech Head Brothers, a French portal about Microsoft .NET technologies.

He is currently employed by Innoveo Solutions since 10/2007 as a Senior Solution Architect and certified Scrum Master.

Founder, owner and Managing Partner of Jobping, which provides a unique and efficient platform for connecting Microsoft skilled job seekers with employers using Microsoft technologies.

Laurent was awarded Most Valuable Professional (MVP) by Microsoft from April 2002 to April 2012.

JetBrains Academy Member
Certified ScrumMaster
My status

Twitter

Flickr

www.flickr.com
This is a Flickr badge showing public photos and videos from Laurent Kempé. Make your own badge here.

Month List

Page List