ReSharper 9: Microsoft Reference Source, Instead of Decompiled .cs Files

1.6k views Asked by At

I'm using ReSharper 9.1.1 on Visual Studio 2013. On some classes, for example System.Data.SqlClient.SqlParameter when I right click on the word SqlParameter and click

Go to Definition

it directs me to some decompiled cs file

C:\Users\X\AppData\Local\JetBrains\Shared\v02\DecompilerCache\decompiler\D514DFA3-5BC8-4AE6-ABD0-D615A7C2893F\3c\1ec3bc9a\SqlParameter.cs

On the top of the file it says:

// Decompiled with JetBrains decompiler
// Type: System.Data.SqlClient.SqlParameter
// Assembly: System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// MVID: D514DFA3-5BC8-4AE6-ABD0-D615A7C2893F
// Assembly location: C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Data.dll

But on some other classes, for example System.DateTime when I right-click on DataTime and click Go to Definition, it directs me to this file:

C:\Users\X\AppData\Local\Temp\SymbolCache\src\Source\51209.34209\Source\ndp\clr\src\BCL\System\DateTime.cs

This file, it says;

//------------------------------------------------------------------------------
// copyright file="MessageBox.cs" company="Microsoft"
// Copyright (c) Microsoft Corporation. All rights reserved.
// /copyright
//-----------------------------------------------------------------------------

So this has come from Microsoft's reference source website, and the other decompiled with ReSharper.

Why some of the source code is decompiled and some of them downloaded from Miscoroft Reference Source? I want all of the sources come from Microsoft reference source website, not decompiled from .NET files.
They are the same in practice, but different in details. (comments, etc.)

  • In ReSharper Options, I've checked; Tools > External Sources > Navigation to Sources > Allow downloading from remote locations
  • In VS 2013 Options, I've checked; Debugging > Enable.NET Framework source stepping,
  • In VS 2013 Options, I've checked; Debugging > Enable source server support,
  • In VS 2013 Options, I've unchecked; Debugging > Enable Just My Code,
  • I've cleared ReSharper cache,
  • Deleted DecompilerCache folder C:\Users\X\AppData\Local\JetBrains\Shared\v02\DecompilerCache
  • I've installed dotPeek 1.4, tried with it,
  • Uninstalled dotPeek,
  • Uninstalled ReSharper, deleted C:\Users\X\AppData\Local\JetBrains\ folder and Reinstalled ReSharper again,
  • I've cleared solution with Visual Studio; Build > Clean Solution

How should I do to see only sources from http://referencesource.microsoft.com/ ?
Do we have any option to clear ReSharper's decompiled cache, and disable the decompile feature, until I have it enabled ?

Edit: I'm using .NET Framework 4.5.1 libraries.

UPDATE: As of Resharper 9.2 and Visual Studio 2015 and .NET Framework 4.6; nothing has changed for me. The problem still persists and it is happening to some other classes too. Is anything we can do on our side, like suppressing cached .cs files using the ones I prefer?

1

There are 1 answers

6
citizenmatt On BEST ANSWER

ReSharper will try to download a .pdb file for the assembly that's defining the type you're trying to view. But Microsoft don't have all .pdb files for all specific versions of all assemblies in the framework available to download - and if the .pdb isn't available, ReSharper falls back to decompiling the type.

The reference source site spent a long time not being updated, and many versions (especially for hot fixes and service packs) didn't get uploaded, and as more updates were released, more source wasn't available for download. As of .net 4.5.1, the current process for any update to the .net assemblies means the .pdb file (and source) is automatically uploaded to the reference source site, so it should work for more recent versions of assemblies. But if it's an earlier assembly (and I think there are some assemblies that aren't included in reference source), then it might not be available to download.

That said, it looks like there might be a ReSharper issue with this particular assembly. When trying to navigate to SqlParameter, ReSharper correctly downloads a system.data.pdb file, but fails to find any source information in it. Looking at the file, there does appear to be source information in there. I've raised an issue that you can vote and track - RSRP-440610.