InliningAnalyzer
InliningAnalyzer copied to clipboard
F# support
In VS 2017 in my F# (dotnet SDK project type) Project I do get the tools menu item. The following error thrown from Tools\Inlining Analyzer\Run Inlining Analyzer on (current project). Running the assembly analyzer apparently succeeds, but no highlighting. From the looks of the error it appears to be in the highlighting.
System.AggregateException: One or more errors occurred. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at VsExtension.Model.CodeModel.GetMethodCall(Cache doc, TextSpan textSpan) in C:\work\GitHub\InliningAnalyzer\src\VsExtension\Model\CodeModel.cs:line 33
at VsExtension.QuickInfo.QuickInfoSource.AugmentQuickInfoSession(IQuickInfoSession session, IList`1 qiContent, ITrackingSpan& applicableToSpan) in C:\work\GitHub\InliningAnalyzer\src\VsExtension\QuickInfo\QuickInfoSource.cs:line 75
at Microsoft.VisualStudio.Language.Intellisense.Implementation.LegacyQuickInfoSource.AugmentQuickInfoSession(IAsyncQuickInfoSession session, IList`1 content, ITrackingSpan& applicableToSpan)
at Microsoft.VisualStudio.Language.Intellisense.Implementation.AsyncQuickInfoSession.<TryComputeContentFromLegacySourceAsync>d__46.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Language.Intellisense.Implementation.AsyncQuickInfoSession.<ComputeSourceContentAsync>d__39.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)
--- End of inner exception stack trace ---
at Microsoft.VisualStudio.Language.Intellisense.Implementation.AsyncQuickInfoSession.<UpdateAsync>d__32.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Language.Intellisense.Implementation.AsyncQuickInfoPresentationSession.<UpdateAsync>d__5.MoveNext()
---> (Inner Exception #0) System.NullReferenceException: Object reference not set to an instance of an object.
at VsExtension.Model.CodeModel.GetMethodCall(Cache doc, TextSpan textSpan) in C:\work\GitHub\InliningAnalyzer\src\VsExtension\Model\CodeModel.cs:line 33
at VsExtension.QuickInfo.QuickInfoSource.AugmentQuickInfoSession(IQuickInfoSession session, IList`1 qiContent, ITrackingSpan& applicableToSpan) in C:\work\GitHub\InliningAnalyzer\src\VsExtension\QuickInfo\QuickInfoSource.cs:line 75
at Microsoft.VisualStudio.Language.Intellisense.Implementation.LegacyQuickInfoSource.AugmentQuickInfoSession(IAsyncQuickInfoSession session, IList`1 content, ITrackingSpan& applicableToSpan)
at Microsoft.VisualStudio.Language.Intellisense.Implementation.AsyncQuickInfoSession.<TryComputeContentFromLegacySourceAsync>d__46.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Language.Intellisense.Implementation.AsyncQuickInfoSession.<ComputeSourceContentAsync>d__39.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)
As you have already guessed in the other ticket, F# is not supported. Running the analyzer and getting the inlining information from the JIT compiler is language independent, but for mapping that information to the source code I use Roslyn, which doesn't support F# AFAIK. It could probably work for F# as well by using the F# Compiler Services, but I don't know much about them and this is definitely a major rework. I don't have any plans to do that at the moment.
I'll have a look at how I can at least provide a nicer error message instead of the exception though.
If you leave this open, someone in the F# community with more FCS experience than me may take a swing at it.