Roslyn: Solution containing F# and C# projects break some C# tooling, even if projects are not referencing each other

Created on 12 Jul 2018  ยท  40Comments  ยท  Source: dotnet/roslyn

Version Used: 15.6, 15.7.4, 15.8 preview 4

Steps to Reproduce:

  1. Create new solution
  2. Create a C# project and a F# project
  3. Try to perform a rename operation in C# and watch it not work

Expected Behavior:

Rename should properly rename when pressing Enter.

Actual Behavior:

Nothing happens when pressing Enter on rename.

--

This isn't specific to rename, there are other issues when trying to do F12 navigation.
This is directly related to this: https://github.com/Microsoft/visualfsharp/issues/4796#issuecomment-404344061

Quoting from the issue here:

After investigation in the case of using rename for a type in C#, Roslyn will iterate over all projects to try to find that type. When it hits a F# project, it will throw because it is trying to get a ISyntaxFactsService from our language service which we don't have and never will. https://github.com/dotnet/roslyn/blob/master/src/Workspaces/Core/Portable/FindSymbols/FindReferences/DependentTypeFinder_ProjectIndex.cs#L55

When that throws, it will cancel C#'s rename task and nothing works.

I don't think this is a regression, or at least a very recent one. Most of the code paths to get to this point haven't changed from 11 months to 2 years.

This also occurs even if the C# project isn't referenced or is referencing a F# project.

Area-IDE Bug

Most helpful comment

@jasonmalinowski, I see this getting pushed again and again. Is it too big of a task or is it just not important enough? It sure is a big pain for my team and probably many others. Really looking forward to see this resolved! ๐Ÿ™‚

All 40 comments

Seems like this could have been introduced in the following commit:

https://github.com/dotnet/roslyn/commit/95a2444883741b61d44385d9bb7040ba33778ca3#diff-cae35fdca4a58c14603b4de0661109bbR606

and the previous default behaviour was to ignore case:

https://github.com/dotnet/roslyn/commit/95a2444883741b61d44385d9bb7040ba33778ca3#diff-cae35fdca4a58c14603b4de0661109bbL729

Indeed, that path does look bad. My attempts to reproduce this internally are currently being thrwarted by a worse bug that means creating a C# project prevents F# projects from being loaded.

Fixed by #28789 (tracing back to Rename refactor crashes)

@jasonmalinowski, @davidagross
Is this in 15.8.0? I'm still observing the issues.

  • Activating Refactor Rename on a symbol does nothing.
  • Ctrl+F12 Go To Implementation also doesn't work.

I can confirm that unloading the F# project from the solution fixes the problem. So it looks to be the same root issue.

On the upside, activating the commands hasn't crashed Visual Studio so far...

@rlreis90 Which exact version are you running from Help > About? We did fix some of these, but there was also another bug we fixed which has the symptoms you're describing.

It's also possible there's still more bugs here, which wouldn't surprise me.

I am running

Microsoft Visual Studio Community 2017
Version 15.8.0
VisualStudio.15.Release/15.8.0+28010.0
Microsoft .NET Framework
Version 4.7.02558
Installed Version: Community

I am finding that Ctrl+. or Ctrl+R, Ctrl+R renames are successful now, without unloading my F# projects from the mixed C#/F# solutions, whereas in 15.7.3 a rename attempt would literally crash VS literally every time.

With Ctrl+F12 I do however still get this if my F# projects are loaded, and I don't get it if they are unloaded:

image

Activity log entry:

<entry>
    <record>856</record>
    <time>2018/08/18 09:15:39.386</time>
    <type>Error</type>
    <source>Editor or Editor Extension</source>
    <description>System.AggregateException: One or more errors occurred. ---&gt; System.AggregateException: One or more errors occurred. ---&gt; System.AggregateException: One or more errors occurred. ---&gt; System.NullReferenceException: Object reference not set to an instance of an object.&#x000D;&#x000A;   at Microsoft.CodeAnalysis.FindSymbols.DependentTypeFinder.ProjectIndex.&lt;CreateIndexAsync&gt;d__8.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)&#x000D;&#x000A;   --- End of inner exception stack trace ---&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.FindSymbols.DependentTypeFinder.&lt;AddSourceTypesInProjectAsync&gt;d__29.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.FindSymbols.DependentTypeFinder.&lt;FindTypesInProjectAsync&gt;d__19.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.FindSymbols.DependentTypeFinder.&lt;FindTypesAsync&gt;d__17.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.FindSymbols.DependentTypeFinder.&lt;&gt;c__DisplayClass9_0.&lt;&lt;FindTypesFromCacheOrComputeAsync&gt;b__0&gt;d.MoveNext()&#x000D;&#x000A;   --- End of inner exception stack trace ---&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.FindSymbols.DependentTypeFinder.&lt;FindTypesFromCacheOrComputeAsync&gt;d__9.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.&lt;FindOverridesAsync&gt;d__39.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.&lt;FindOverridesAsync&gt;d__38.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.Editor.FindUsages.FindUsagesHelpers.&lt;FindImplementationsWorkerAsync&gt;d__4.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.Editor.FindUsages.FindUsagesHelpers.&lt;FindImplementationsAsync&gt;d__3.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.Editor.FindUsages.FindUsagesHelpers.&lt;FindImplementationsAsync&gt;d__2.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.Editor.FindUsages.AbstractFindUsagesService.&lt;FindImplementationsAsync&gt;d__0.MoveNext()&#x000D;&#x000A;   --- End of inner exception stack trace ---&#x000D;&#x000A;   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)&#x000D;&#x000A;   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.Editor.GoToImplementation.GoToImplementationCommandHandler.StreamingGoToImplementation(Document document, Int32 caretPosition, IFindUsagesService findUsagesService, IStreamingFindUsagesPresenter streamingPresenter, CancellationToken cancellationToken, String&amp; messageToShow)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.Editor.GoToImplementation.GoToImplementationCommandHandler.ExecuteCommand(Document document, Int32 caretPosition, IFindUsagesService streamingService, CommandExecutionContext context)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.Editor.GoToImplementation.GoToImplementationCommandHandler.ExecuteCommand(GoToImplementationCommandArgs args, CommandExecutionContext context)&#x000D;&#x000A;   at Microsoft.VisualStudio.Commanding.CommandHandlerExtensions.ExecuteCommand[T](ICommandHandler commandHandler, T args, Action nextCommandHandler, CommandExecutionContext executionContext)&#x000D;&#x000A;   at Microsoft.VisualStudio.UI.Text.Commanding.Implementation.EditorCommandHandlerService.&lt;&gt;c__DisplayClass14_1`1.&lt;Execute&gt;b__1()&#x000D;&#x000A;   at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.CallExtensionPoint(Object errorSource, Action call, Predicate`1 exceptionFilter)&#x000D;&#x000A;---&gt; (Inner Exception #0) System.AggregateException: One or more errors occurred. ---&gt; System.AggregateException: One or more errors occurred. ---&gt; System.NullReferenceException: Object reference not set to an instance of an object.&#x000D;&#x000A;   at Microsoft.CodeAnalysis.FindSymbols.DependentTypeFinder.ProjectIndex.&lt;CreateIndexAsync&gt;d__8.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)&#x000D;&#x000A;   --- End of inner exception stack trace ---&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.FindSymbols.DependentTypeFinder.&lt;AddSourceTypesInProjectAsync&gt;d__29.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.FindSymbols.DependentTypeFinder.&lt;FindTypesInProjectAsync&gt;d__19.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.FindSymbols.DependentTypeFinder.&lt;FindTypesAsync&gt;d__17.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.FindSymbols.DependentTypeFinder.&lt;&gt;c__DisplayClass9_0.&lt;&lt;FindTypesFromCacheOrComputeAsync&gt;b__0&gt;d.MoveNext()&#x000D;&#x000A;   --- End of inner exception stack trace ---&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.FindSymbols.DependentTypeFinder.&lt;FindTypesFromCacheOrComputeAsync&gt;d__9.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.&lt;FindOverridesAsync&gt;d__39.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.&lt;FindOverridesAsync&gt;d__38.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.Editor.FindUsages.FindUsagesHelpers.&lt;FindImplementationsWorkerAsync&gt;d__4.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.Editor.FindUsages.FindUsagesHelpers.&lt;FindImplementationsAsync&gt;d__3.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.Editor.FindUsages.FindUsagesHelpers.&lt;FindImplementationsAsync&gt;d__2.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.Editor.FindUsages.AbstractFindUsagesService.&lt;FindImplementationsAsync&gt;d__0.MoveNext()&#x000D;&#x000A;---&gt; (Inner Exception #0) System.AggregateException: One or more errors occurred. ---&gt; System.NullReferenceException: Object reference not set to an instance of an object.&#x000D;&#x000A;   at Microsoft.CodeAnalysis.FindSymbols.DependentTypeFinder.ProjectIndex.&lt;CreateIndexAsync&gt;d__8.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)&#x000D;&#x000A;   --- End of inner exception stack trace ---&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.FindSymbols.DependentTypeFinder.&lt;AddSourceTypesInProjectAsync&gt;d__29.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.FindSymbols.DependentTypeFinder.&lt;FindTypesInProjectAsync&gt;d__19.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.FindSymbols.DependentTypeFinder.&lt;FindTypesAsync&gt;d__17.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.FindSymbols.DependentTypeFinder.&lt;&gt;c__DisplayClass9_0.&lt;&lt;FindTypesFromCacheOrComputeAsync&gt;b__0&gt;d.MoveNext()&#x000D;&#x000A;---&gt; (Inner Exception #0) System.NullReferenceException: Object reference not set to an instance of an object.&#x000D;&#x000A;   at Microsoft.CodeAnalysis.FindSymbols.DependentTypeFinder.ProjectIndex.&lt;CreateIndexAsync&gt;d__8.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)&lt;---&#x000D;&#x000A;&lt;---&#x000D;&#x000A;&lt;---&#x000D;&#x000A;</description>
  </entry>

Ach, I just ran into a Ctrl+R, Ctrl+R rename that hangs (it's search doesn't complete) but executes just fine after unloading the F# project in the mixed solution. I wonder why it was different from the other renames that worked...

@jasonmalinowski I'm running 15.8.1 atm, same status.

I did get the same "This may be caused by an extension" popup as @davidagross.

Rename hasn't made the UI hang or crash for me so far (it did previously), but it simply does nothing; it doesn't highlight the text in green, nothing.

@rlreis90, words mean things and I should have been precise: VS doesn't hang but the search window in Ctrl+R, Ctrl+R doesn't find any of the instances, as if its search process hangs, though VS is otherwise still responsive.

@davidagross renaming local variables or private members always worked, just public renaming had/has issues.

@rlreis90 it crashed only if you try to rename a public member which is used by the F# binary.

I have had the same problems mentioned is this issue with the latest versions of Visual Studio. My solution contains both C# and F# projects, and Rename and "Find all references" on public members are not working. I have rolled my Visual Studio back to version 15.4.5, which is the latest version of VS that does not have these problems. So I guess the issue has been introduced with the release of version 15.5.

Just updated to latest version and now some symbols aren't even loading anymore (editor time). F12 doesn't work on them & Error List marks them as errors.

@TIHan Are we still getting reports of issues like this?

@jasonmalinowski, I have just testet my Solution in Visual Studio 2017 15.9.2, and it is still the same problem: My solution contains both C# and F# projects, and Rename and "Find all references" on public members are not working. I have rolled my Visual Studio back to version 15.4.5, which is the latest version of VS that does not have these problems. So I guess the issue has been introduced with the release of version 15.5.

Yes, it's still broken. Here is a (maybe not complete) list, both for Rename and Find All References:

What | Private | Public
--- | --- | ---
Type | โœ”๏ธ | โœ”๏ธ
Field | โœ”๏ธ | โœ”๏ธ
Property | โœ”๏ธ | โŒ
Event | โœ”๏ธ | โŒ
Function | โœ”๏ธ | โŒ

Microsoft Visual Studio Professional 2017
Version 15.9.2

Installed Extension | Version
--- | ---
Visual F# Tools | 15.8.20181029.1
Visual F# Templates | 15.8.20181029.1
Visual Studio 2017 Tools for Unity | 3.9.0.2
Microsoft Visual Studio Test Platform | 15.9.0.2018100802
Roslyn Expression Evaluators | 2.10.0.6350103
Roslyn Interactive Components | 2.10.0.6350103
Roslyn Language Services | 2.10.0.6350103
Productivity Power Tools 2017/2019 | 16.0
CodeMaid | 10.5.119
Dotnet Extensions for Test Explorer | 15.3.0.10
ProjectConfigurationmanager | 1.7.1099

PS: But VS doesn't crash any more ๐Ÿ‘

@JanWosnitza Can you clarify whwat you mean by 'broken' here? Thanks!

Hi @CyrusNajmabadi, with broken I mean the following:

Rename

When renaming a public property/event/function using Visual Studio's refactoring tools: It starts the renaming process. I can change the name. But when hitting RETURN to accept the new name it's not renaming.

_(here was a gif to showcase the problem, but it's not available anymore)_

Find All References

_Find All References_ opens the Find All References window but does not show any references except the one where you started the search for and the progress-bar never finishes.

_(here was a gif to showcase the problem, but it's not available anymore)_

Repoduction

I also noticed, that indeed it works when the C# project is not referenced by any F# project now. Thus I tried to reproduce the bug in a small solution:

  1. Create a C# library project
  2. Create an F# console project
  3. add C# library to references of F# console
  4. Rename or find references

You can download my test solution here: Test.zip

I've also encounter a problem with the rename dialogue which may have bearing on the others reported here.
_I end up here as this is other issues reported to do with Rename are closed off as duplicates of this issue. Though this one does seem to be a more specific case._

This is for Visual Studio 2017 15.9.3

Problem

  • Buttons on Rename Dialog failed to respond including shutting it down using Title Bar buttons.
  • Dialog appearance became corrupted if resized.

Reproducing Problem (maybe)

  • I selected an Enum field and renamed then also selected to rename any strings, comments, and preview changes (I wanted to know where the strings and comments where changed.)
  • While examining what renames would be done in the Rename Dialog I clicked inside the preview window. (No real reason for doing this.)
  • After this the problem described above occurred.
  • I shutdown Visual Studio by killing the process in Task Manager.
  • Once restarted the rename operation had been completed.

_Screen shot of corrupted Rename Dialog_

image

If you can't reproduce or require more information, don't hesitate to ask :)

Open mixed solution in VS 15.9.4
Rebuild All succeeds
Position cursor on interface name in .cs file (single implementation is in some .fs file)
Right click - Go to Implementation

An exception has been encountered. This may be caused by an extension.
You can get more information by examining the file '.....ActivityLog.xml'.

I started VS with devenv /Log, tried to rename the property, but in the file ActivityLog.xml are no errors reported.

Is this issue still alive? I'm waiting for the bugfix for one and a half year now. ๐Ÿ˜€

you are lucky. We are waiting for fix more than 2 years. Looks like F# is no longer evolving ...

@jasonmalinowski, I see this getting pushed again and again. Is it too big of a task or is it just not important enough? It sure is a big pain for my team and probably many others. Really looking forward to see this resolved! ๐Ÿ™‚

I see this getting pushed again and again. Is it too big of a task or is it just not important enough

Can you clarify. Is the issue that there are legitimate bugs where the product just breaks when you try to do things? i.e. you try to do a rename, and simply nothing happens (probably because something crashed internally), as opposed to just C# or just F# performing the rename.

Or is the issue that there are feature requests for C# and F# to work better? For example, that you'd like to be able to more easily jump between languages, or have a rename in one language reflected in the other.

I'm a bit lost as to what the current state is here. Thanks!

Note: if hte issue is that things are broken, it's likely the case that F# should drive investigations into finding out what's up there and pushing for the relevant fixes. If the issue is better feature support between the languages, that is certainly being looked into (for example: https://github.com/dotnet/roslyn/pull/33723) but it is a large and complex space, and Roslyn is a project with thousands of issues and hundreds of PRs for the team to get through. If you'd like to help contribute time/PRs here, that would likely be super helpful.

@CyrusNajmabadi, the IDE is throwing an exception when I'm trying to jump to implementation (ctrl+f12) in a mixed C#/F# solution. I don't have the stack trace/log file in front of me, but I can provide it tomorrow if that would help solve the issue.

It's not a feature request, but an annoying bug that has been around for years now. I was excited when I first search around for this bug and noticed it was assigned to a milestone, but seeing how it's just pushed forward, I've almost lost hope.

Let me know if I can be of further assistance. I don't think I would have the spear time to dig deep enough into this issue to solve it and make a PR myself, so I'm hoping I can somehow bump it up the list of prioritized tasks.

@CyrusNajmabadi, the IDE is throwing an exception when I'm trying to jump to implementation (ctrl+f12) in a mixed C#/F# solution. I don't have the stack trace/log file in front of me, but I can provide it tomorrow if that would help solve the issue.

Would definitely be helpful. Note: the original post says this:

After investigation in the case of using rename for a type in C#, Roslyn will iterate over all projects to try to find that type. When it hits a F# project, it will throw because it is trying to get a ISyntaxFactsService from our language service which we don't have and never will.

People def seem to care deeply about this. My recommendation would be to just open a PR that fixes this.

I have a fix for the rename crash.

@CyrusNajmabadi
it looks strange. I have reported the issue with steps to reproduce:
VS Community
GitHub

But my issue has marked as duplicated. Now we see that this issue maked as fixed, but my the initial problem still reproducible. Looks like the nature of the problem was not researched by the man which mark issues as duplicate.

@CyrusNajmabadi, the stack trace I'm seeing is the same as in @davidagross's comment. There's a nullref exception being thrown somewhere. I'm working on putting together a minimal solution that can be used to reproduce the issue.

@CyrusNajmabadi, there is a zip attached to https://github.com/dotnet/roslyn/issues/28474#issuecomment-444447681 with a VS solution already setup and if follow the repro steps at that same comment, you should see that e.g. renaming doesn't work.

@veloek @JanWosnitza Yes. I opened a fix for this a couple of days ago: https://github.com/dotnet/roslyn/pull/38841

Cheers!

๐ŸŽˆ Is this real life? ๐ŸŽ‰ #MadeMyYear ๐Ÿ‘Œ
(even though it might be too early:) Thanks a lot!

Fix is merged, and should be in 16.4 Preview 3.

And @veloek my apologies for punting the bug a few times from one release to the next. This bug was on my plate as the "we should get to it" and the invariably some last minute things always resulted in it getting punted. Asking about it was absolutely 100% the right thing to do since "customers are complaining" is always the easiest way to prioritize something higher!

@jasonmalinowski, yeah I was hoping a friendly nudge would bump it up the list of prioritized tasks :slightly_smiling_face:

VS 16.4 Preview 3 is out and I can confirm that "go to implementation" now works! A day of celebration! ๐ŸŽ‰

Hmm.... It is interesting solution. Now the project reference to F# project looks like a reference to assembly. As result you can not rename members which are using in both projects.
Find all references feature show code from the F# project as metadata. Good work! It looks like F# buried by Microsoft.

@Droni can you file a new issue about this. I don't believe any of my changes shoudl have had that sort of effect. Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

binki picture binki  ยท  3Comments

marler8997 picture marler8997  ยท  3Comments

orthoxerox picture orthoxerox  ยท  3Comments

glennblock picture glennblock  ยท  3Comments

MadsTorgersen picture MadsTorgersen  ยท  3Comments