AutoMapper / ReSharper Configuration
Fixing the cause of a ridiculous slowdown
The Challenge
While working on a project, I noticed that Visual Studio ground to a halt while I was working on a rather in-depth AutoMapper profile. Something clicked in the back of my head, remembering a similar issue I experience about a year ago. Both times I had experienced this issue, the slowdown happened while editing an AutoMapper profile.
The Cause
AutoMapper profiles are basically a series of LINQ method chains along the lines of:
CreateMap<T,TU>()
.ForMember(destination => destination.Property1, option => option.MapFrom(source => source.SourceProperty1))
.ForMember(destination => destination.Property2,...)
.ForMember(...);
As you may imagine, a particularly complicated Profile may have dozens of Properties to map. My assumption is that the performance issue is ReSharper attempting to analyze the method chain and blowing up
The Solution
I found that ReSharper allows users to exclude files from analysis based on File Extension or Folder location. I opted to use the folder location based on a ReSharper Ultimate Blog Entry which points to the settings page: ReSharper | Options | Code Inspection | Settings
TL;DR
ReSharper seems to have been blowing up when attempting to analyze the AutoMapper Profile's LINQ method chain.
Software Development Nerd