-4

enter image description here

Reproduce as follows:

  1. Create a WPF application (.Net 4.8).
  2. Click on the codebehind tab.
  3. Hover over the class name (MainWindow).

You will now see a popup saying

MainWindow

instead of saying

Interaction logic for MainWindow.xaml

This is not the expected behavior. How do I fix that?

ispiro
  • 26,556
  • 38
  • 136
  • 291
  • Could you provide a minimal example that reproduces the problem? It's hard to answer the question without it. – Emond Jun 09 '21 at 20:47
  • 4
    @ispiro How about instead *you* create a WPF UserControl, add an xml comment (and inheritdoc to its ctor) and add that to the question? – Ken Wayne VanderLinde Jun 09 '21 at 21:00
  • 2
    @ispiro - My apologies, I should have been more clear: please add the xaml and/or C# that causes this effect. – Emond Jun 09 '21 at 21:03
  • 1
    @KenWayneVanderLinde See edit. – ispiro Jun 10 '21 at 09:43
  • 1
    @EmondErno See edit. (And thanks for clarifying.) – ispiro Jun 10 '21 at 09:44
  • @ispiro - Most people here know how to create a WPF application (that is why they are reading the question in the first place) What we do need is the code (the *actual* code) that shows the problem. Not because we do not know how to make a WPF application but to actually see/debug *your* problem. – Emond Jun 10 '21 at 12:16
  • 5
    @ispiro: I just tried your steps, the tooltip of MainWindow looks as follows: https://i.stack.imgur.com/q2uF4.png – BDL Jun 10 '21 at 14:16
  • @BDL Thank you! Finally a helpful comment. Now I wonder why the discrepancy between what you see and what I see. Maybe the .net version? I'm using .net 4.8. Which are you using? – ispiro Jun 10 '21 at 14:18
  • 2
    @ispiro: The comment is now helpful because until you posted the screenshot I thought you are talking about the first line of the tooltip instead of the second one. I tested with .NET framework 4.6, 4.7.2, 4.8 and .NET 5, always same behavior. – BDL Jun 10 '21 at 14:20
  • Thanks. Now off to find what's wrong with my installation of Visual Studio.... (and yes, it's the latest update - 16.10.1). – ispiro Jun 10 '21 at 14:23
  • Documentation pointing to the expected behavior is helpful: https://learn.microsoft.com/en-us/dotnet/csharp/codedoc – JDB Jun 10 '21 at 14:29
  • @JDBstillremembersMonica But that page doesn't show how it's supposed to appear when hovering over it. (Also, if someone doesn't know how xml-comments work, I would expect them to skip my question altogether.) – ispiro Jun 10 '21 at 14:33
  • The problem is that there are so many possible ways that the doc comments could be disrupted that it's very hard to diagnose with the details you've provided. Those comments have to be compiled. Maybe there's an issue with the compiler behind the scenes (could be that the background service is blocked or crashing); maybe it's a configuration issue with Visual Studio; maybe your code isn't being recognized for some reason. We'd need a lot more details and it's not likely to be an easily reproducible situation. – JDB Jun 10 '21 at 14:36
  • Also, you can use this link: https://learn.microsoft.com/en-us/visualstudio/ide/reference/generate-xml-documentation-comments?view=vs-2019. It shows the intellisense tooltip. – JDB Jun 10 '21 at 14:36
  • It is a `partial` class. So you'll want to look at obj/MainWindow.g.cs for the other part. Where you'll find the XML Doc comment that generated "MainWindow". [This Q+A](https://stackoverflow.com/questions/5984557/xml-commenting-on-partial-classes-methods) talks about the consequences. – Hans Passant Jun 10 '21 at 14:38
  • @JDBstillremembersMonica I didn't know it was only on my machine when I asked the question. So it seemed like a perfectly good question to me. It still does to me. We're not expected to know the answer when we ask. – ispiro Jun 10 '21 at 14:38
  • @HansPassant At first I thought it might be dependent on that (the class being partial) but see [BDL's comment above](https://stackoverflow.com/questions/67910475/why-do-some-xml-comment-show-up-strangely?noredirect=1#comment120054990_67910475) which includes a link to an image showing that _it is_ working for them. – ispiro Jun 10 '21 at 14:40
  • 1
    @ispiro - Obviously you don't need to know the answer before you ask. It helps to do as much research as you can before asking, but sometimes you do your best and the question still doesn't have enough detail or is just too unique to your situation to answer. If your question gets closed, don't take it too personally. I've had lots of questions closed. It happens sometimes. However, Han's comment seems to get toward an answer. – JDB Jun 10 '21 at 14:43
  • 1
    It seems as if the behavior has changed with the latest visual studio release. When I posted my screenshot I was on 15.9.*, now with 15.10.1 I can reproduce the screenshot op is getting. – BDL Jun 10 '21 at 14:44
  • 1
    Since this is now a problem in all of my projects, I filed a VS bug report. Feel free to vote for it: https://developercommunity.visualstudio.com/t/Visual-Studio-16101-displays-xml-docum/1447342 – BDL Jun 10 '21 at 15:17
  • @BDL You can post your comment as an answer. The question was reopened. – ispiro Jun 10 '21 at 17:00
  • @EmondErno You might be interested to know that it turned out to be a bug. See the comments above by BDL. – ispiro Jun 10 '21 at 17:08

1 Answers1

1

Until BDL posts their answer:

It turned out to be a Visual Studio bug in the latest update.

Link to bug report

ispiro
  • 26,556
  • 38
  • 136
  • 291