InliningAnalyzer icon indicating copy to clipboard operation
InliningAnalyzer copied to clipboard

Method calls not being highlighted

Open cocowalla opened this issue 8 years ago • 9 comments

Is this extension supported by Visual Studio 2017? I've tried it on different projects on 2 different machines, but after doing Tools > Inlining Analyzer > Run inlining analyzer on project, I don't see any calls being highlighted.

I've tried toggling Show/Hide Inlining Analyzer Coloring, but it doesn't make any difference.

I have ReSharper installed, if it makes any difference. Any idea what could be wrong here? Are there any kind of diagnostic logs that may help?

cocowalla avatar Dec 23 '17 21:12 cocowalla

Visual Studio 2017 is definitely supported, actually it's the only supported version. Resharper shouldn't be a problem either, I use that too.

There is an output window where all errors should be logged. Main Menu -> View -> Output -> Inlining Analyzer in the dropdown (not sure exactly, can't verify right now. But it's the same window where e.g. the build output is logged).

If there are no errors logged there, maybe the classes you tried it on aren't supported yet (generics?). Could you try it on a simple 'hello world' with just a few calls then, like the sample in the description of the extension?

szehetner avatar Dec 24 '17 07:12 szehetner

Sorry for the late response. Yes, it does seem to work as expected in a 'hello world' type console app, and actually in other complex one too. Actually, it only seems to be this one project it doesn't work on! The 'Inlining Analyzer' log output looks normal though.

Any idea what could be wrong?

cocowalla avatar Jan 08 '18 21:01 cocowalla

Really hard to tell what could be wrong here. I guess the source code for this project is not publicly available for me to debug this?

What you could try to narrow the error down: Copy a simple class that you know works (e.g. from the 'hello world' project) into this project and see if that is highlighted.

I'm also thinking about building a version with more detailed logging, but not sure when I would be able to do this.

szehetner avatar Jan 09 '18 23:01 szehetner

If you are still interested, could you retry this with the current version (0.7.1)? I fixed a few bugs in the meantime which prevented the highlighting to show up in a few cases and the error logging should also be better now.

szehetner avatar Jul 11 '18 19:07 szehetner

Definitely still interested!

I tried the latest version on 2 different .NET Framework projects on 2 machines, and on both I now get:

Starting Inlining Analyzer...
Assembly: C:\MyProject\bin\Release\MyProject.exe
Runtime: NetFramework
Platform: X64
Scope: All Types and Methods

System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Diagnostics.FastSerialization, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'Microsoft.Diagnostics.FastSerialization, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
   at InliningAnalyzer.EtwCollector.StartEventTrace(Int32 processId)
   at VsExtension.Shell.Runner.JitRunner.RunJitCompiler(JitHostController jitController) in C:\work\GitHub\InliningAnalyzer\src\VsExtension\Shell\Runner\JitRunner.cs:line 89
   at VsExtension.Shell.Runner.JitRunner.Run() in C:\work\GitHub\InliningAnalyzer\src\VsExtension\Shell\Runner\JitRunner.cs:line 35
   at VsExtension.InliningAnalyzerCommands.<RunAnalyzer>d__24.MoveNext() in C:\work\GitHub\InliningAnalyzer\src\VsExtension\Shell\InliningAnalyzerCommands.cs:line 252

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

cocowalla avatar Jul 14 '18 20:07 cocowalla

Aha, some progress!

I tried installing the Microsoft.Diagnostics.Tracing.TraceEvent package, and this error goes away, and I get inlining highlighting!

There are a couple of other issues tho:

  1. I had to go in and select NetFramework as the preferred runtime in the Inlining Analyzer settings - would be nice if this happened automatically for projects that aren't multi-targetting
  2. One of my projects targets x64, as it has a dependency on a native 64-bit library, but this results in an error when running the Inlining Analyzer:
Starting Inlining Analyzer...
Assembly: C:\MyProject\bin\Release\MyProject.exe
Runtime: NetFramework
Platform: X64
Scope: All Types and Methods

Unhandled Exception: System.BadImageFormatException: Could not load file or assembly 'MyProject, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. This assembly was compiled for a different processor.
   at System.Reflection.RuntimeAssembly.nLoadFile(String path, Evidence evidence)
   at System.Reflection.Assembly.LoadFile(String path)
   at InliningAnalyzer.JitCompilerFactory.Create(String[] args)
   at JitHost.x64.Program.Main(String[] args)
Finished Inlining Analyzer

It works for most of the project if I switch the project to Any CPU, but then of course I can't run the project :)

cocowalla avatar Jul 14 '18 21:07 cocowalla

You shouldn't have to install the TraceEvent package. I suspect this could be a missing binding redirect, I'll add that.

Unfortunately I couldn't reproduce the preferred runtime and the x64 issue. The runtime selection should work as you describe and the x64 version seems to fail even though it is run with the x64 analyer exe. Could you post the relevant parts of your .csproj? i.e. the part with PlatformTarget, TargetFrameworkVersion, etc.

szehetner avatar Jul 23 '18 19:07 szehetner

From the csproj file for the x64 project:

<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
<PlatformTarget>x64</PlatformTarget>

cocowalla avatar Jul 28 '18 20:07 cocowalla

Sorry for the delay, but I think I have made some progress on fixing this. Basically the dependencies where all messed up because I targetet .NET 4.7.1 for the extension, which I just recently learned you shouldn't do (see https://github.com/github/VisualStudio/issues/1849#issuecomment-411570902 for background). So I after some restructuring and dependency removal things should be better now.

Could you please try it with the latest version (0.7.2) and check if the issues are fixed?

szehetner avatar Aug 25 '18 21:08 szehetner