Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 C# Implement Virtual Methods oddities
 New Topic  Reply to Topic
 Printer Friendly
Author  Topic Next Topic  

nitz
Junior Member

16 Posts

Posted - Aug 01 2019 :  11:36:19 AM  Show Profile  Reply with Quote
Hello!

I've recently been doing a lot of work in C# and have run into some funny things with the way "Implement Virtual Methods" seems to be working in C# currently.

First, it sometimes seems to incorrectly change method access modifiers. Searching the forms it seems someone has brought this up (case=115414), but I'm seeing it in winforms things without Xamarin.

As an example: Inheriting from System.Windows.Forms.Design.ControlDesigner, and overriding PreFilterProperties(): https://i.imgur.com/MABo8WY.png

Results in: https://i.imgur.com/TdoLA6d.png -- with a public access modifier, despite needing to be `protected`.

It's worth mentioning that the method `PreFilterProperties()` is initially defined by `IDesignerFilter`, which obviously does not specify access modifiers, where as the class up the tree `ComponentDesigner` does declare it protected. Perhaps that's some part of what's causing the issue?

--

My second issue with Implement Virtual Methods is that for some classes, a slew of methods come pre-checked despite not needing to be.

An example for this is overriding a UserControl. The first time I open "Implement Virtual Methods" and just hit okay without doing anything, it adds nearly 50 methods! And Doing it again adds even more! I feel like by default it shouldn't have anything checked and I should be able to tick just the ones I want (unless there are any abstract methods that aren't implemented, or interface methods not defined -- those could come checked.) But in the case of UserControl, everything is satisfied already (`class M : UserControl{}` complies just fine)

Thanks for the help!

--

Info:
VA_X.dll file version 10.9.2341.0 built 2019.07.11
DevEnv.exe version 16.1.29102.190 Community
msenv.dll version 16.0.29020.237
Comctl32.dll version 6.10.18362.239
Windows 10 10.0 1903 Build 18362.239
8 processors (x86-64, WOW64)
Language info: 1252, 0x409

accord
Whole Tomato Software

United Kingdom
3212 Posts

Posted - Aug 02 2019 :  04:23:17 AM  Show Profile  Reply with Quote
I was able to reproduce your first problem:

case=141044

Thank you for the clear description and the tip about why it fails.
I'll look into your second problem as well.
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3212 Posts

Posted - Aug 02 2019 :  2:02:12 PM  Show Profile  Reply with Quote
I wasn't completely able to reproduce your second problem. When I run Implement Virtual Methods on your example, I only get ActivateControl ticked.
Can you please create a clean new C# Windows Forms App project and paste the below code to the bottom of Form1.cs and run Implement Virtual Method on it to see if you get a different result?

class M : UserControl
{
}


I'm using Visual Studio 2019 and Visual Assist 2341.

Since your sample code compiles without adding anything, I think that adding ActivateControl is already unnecessary by default. I have put in a bug report for that:

case=141050
Go to Top of Page

nitz
Junior Member

16 Posts

Posted - Aug 05 2019 :  07:26:46 AM  Show Profile  Reply with Quote
I updated my visual studio to the lastest non-prerelease (16.2) and gave it a shot too, still seeing it pasted below Form1 in Form1.cs. Here's a short video clip of what I'm seeing: https://i.imgur.com/8rfQP97.gifv

In particular, the ones that seem checked are all marked abstract (despite must have been overridden somewhere else up the inheritance tree.) It also doesn't seem to be whole objects either. For example: https://i.imgur.com/NDLVBMJ.png IPersistStreamInit there has GetClassID grey'd out, InitNew *unchecked*, but the rest checked? I'm not seeing any rhyme or reason to it directly.

I don't think any of the other extensions I have installed should be conflicting in a way like this, but I can provide a list if you'd think that may be part of it too.

Thanks for all the help!

-- Updated version info:
VA_X.dll file version 10.9.2341.0 built 2019.07.11
DevEnv.exe version 16.2.29123.88 Community
msenv.dll version 16.0.29122.156
Comctl32.dll version 6.10.18362.239
Windows 10 10.0 1903 Build 18362.239
8 processors (x86-64, WOW64)
Language info: 1252, 0x409
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3212 Posts

Posted - Aug 05 2019 :  4:44:19 PM  Show Profile  Reply with Quote
This is interesting. I'm not sure what is causing the difference. I'm not familiar with C#, so as a wild guess maybe a different version of .net framework or windows 10 build? I'm using Win10 1903 and .Net Framework 4.8.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
16086 Posts

Posted - Aug 06 2019 :  07:54:23 AM  Show Profile  Reply with Quote
I have reproduced the problem here, now I just want to try and understand why it is happening in one project, but not another. I am seeing this in a newly created C# Forms application, which defaulted to using .NET Framework 4.7.2 when I created it. So it is possible the targeted version of .NET is the key factor here.

zen is the art of being at one with the two'ness
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
16086 Posts

Posted - Aug 06 2019 :  08:34:56 AM  Show Profile  Reply with Quote
Can you please try rebuilding your VA symbol database, via:

VA Options -> Performance -> Rebuild symbol databases

this will require an IDE restart, but should only take a couple of minutes. After doing this I cannot reproduce the problem here any more. So I am wondering if it will have the same effect on your system.

zen is the art of being at one with the two'ness
Go to Top of Page

nitz
Junior Member

16 Posts

Posted - Aug 06 2019 :  10:12:03 AM  Show Profile  Reply with Quote
My default project settings did target .NET Framework 4.7.2.

Rebuilding the symbol database, and re-opening the same project, I see the same behavior accord saw in case=141050, ActivateControl was checked by default and shouldn't have been. Other than that, none of the tons of others seemed to be!

I'm not sure what I did to manage to get it into the state where the symbol database was wonky like that, but resetting it seemed to nearly do the trick, feline! Excellent!
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3212 Posts

Posted - Aug 06 2019 :  11:27:37 AM  Show Profile  Reply with Quote
Thanks guys for the help.
I've checked what my test project is targeting and it is the same: .NET Framework 4.7.2.
But I do have .NET 4.8 installed. If

Tools -> General -> Optimize rendering for screens with different pixel densities (requires restart)

is NOT grayed out, it mean 4.8 is installed.

But I don't think this is a factor. I hope this was a one-off problem. Not sure if it is. But fixing the problem what is always reproducible would be a good start and may fix the occasional other items as well.

Edited by - accord on Aug 06 2019 11:28:49 AM
Go to Top of Page

nitz
Junior Member

16 Posts

Posted - Aug 06 2019 :  11:40:50 AM  Show Profile  Reply with Quote
Interesting. I can't even target .NET 4.8 (https://i.imgur.com/cAqeXWi.png), but I sure have that option not grayed out (https://i.imgur.com/3CQHcdh.png). .NET 4.8 isn't available through the VS Installer yet afaik, and I don't think I've installed the targeting pack/sdk separately.

I'm trying to retrace my steps of how I might have gotten the symbol db in a funky state. I've been maintaining installs of both Visual Studio 2019 and 2017 for a while, and though I removed 2017 recently. Perhaps something funny due to shared symbol dbs between them? (the VS2017 was several patches behind and didn't have nearly the amount of targeting and such I had installed for 2019.)

I really appreciate y'alls help! :)
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
16086 Posts

Posted - Aug 06 2019 :  11:56:25 AM  Show Profile  Reply with Quote
I have also tried a couple of things myself to try and get back to a state where I can see the problem here. A rather wild guess is that jumping between projects using / targeting different versions of .NET can cause VA's symbol database to collect information on more than one version of .NET at a time, and that somehow this is a factor. But if so, I cannot reproduce this quickly and easily.

So hopefully this is something of a one off problem for you.

zen is the art of being at one with the two'ness
Go to Top of Page

nitz
Junior Member

16 Posts

Posted - Sep 11 2019 :  10:18:28 AM  Show Profile  Reply with Quote
I'm sad to report that the implement virtual methods has started acting funny again for me. I think the only change I've made recently has been to update visual studio to one of the latest patch releases.

As last time, rebuild symbol database mitigated the issue. Just wanted to let you know that it did happen again!
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
16086 Posts

Posted - Sep 13 2019 :  07:42:44 AM  Show Profile  Reply with Quote
Do you remember which IDE version you were using before? Also, which version of .NET are you targeting in your solution?

I am wondering if the IDE, or possibly a Windows update, is having an effect on the installed versions of .NET, and VA is not noticing this change, so we are ending up with an out of sync understanding of .NET on your system. This would sort of fit what you are seeing.

The main problem with this theory is that it doesn't explain why this isn't happening more widely, and I have not been able to reproduce it here, even after installing updates. It is almost as if there is another factor at work on your system... but what?

Do you have any other IDE extensions installed? Perhaps any that are unusual, or developed in house? I am just looking for any clues to help us work out possible triggers.

zen is the art of being at one with the two'ness
Go to Top of Page

nitz
Junior Member

16 Posts

Posted - Sep 15 2019 :  8:38:52 PM  Show Profile  Reply with Quote
I've been keeping pace with the updates to visual studio as the patch releases have come out, so I've been installing those as they've been coming down. I haven't installed any new toolsets/runtimes of dotnet except any patches that come in through windows updates.

I do still have (and patch) visual studio 2017, not sure if that may or may not be related.

All the extensions I have are installed via the marketplace, with the exception of a modified "Custom Document Well" to bypass the non-async extension loading. I'm not in the office today but I'll update this thread with a list of everything installed tomorrow.

Otherwise: If I'm able to reproduce it again, is there any files I might be able to collect for you that would help.

Thanks so much for all the assistance!
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
16086 Posts

Posted - Sep 16 2019 :  06:22:12 AM  Show Profile  Reply with Quote
If this happens again it may well be worth getting VA log files, in the hopes that this will offer some clues. Doing so, and finding the generated log files, is explained here:

https://docs.wholetomato.com/default.asp?W305

Everything here sounds fairly normal though, no obvious problems or concerns.

Have you changed the folder where VA stores its symbol database? Doing so is explained here:

https://support.wholetomato.com/default.asp?W332

this seems unlikely, but I am looking for anything "odd" or "unusual" that you might have going on that might be a clue.

zen is the art of being at one with the two'ness
Go to Top of Page

nitz
Junior Member

16 Posts

Posted - Sep 16 2019 :  07:20:48 AM  Show Profile  Reply with Quote
Nope, symbol database is in the default location.

Here's the list of extensions I have:


  • Visual Assist (obviously #9786;)

  • Custom Document Well (the modified one to be able to use despite non-async loading)

  • Live Share

  • Cloud Explorer for VS 2019 Preview

  • Visual Studio IntelliCode

  • Microsoft LIbrary Manager

  • GoToDnSpy

  • Extension in Main menu

  • Time Stamp Margin (PPT)

  • Shrink Empty Lines (PPT)

  • Solution Error Visualizer (PPT)

  • Quick Launch Tasks (PPT)

  • Peek Help (PPT)

  • Middle Click Scroll (PPT)

  • Match Margin (PPT)

  • Fix Mixed Tabs (PPT)

  • Double-Click Maximize (PPT)

  • Copy as Html (PPT)

  • Align Assignments (PPT)

  • Productivity Power Tools 2017/2019

  • Power Commands for Visual Studio (PPT)

  • Test Adapter for Google Test

  • Test Adapter for Boost.Dest

  • Dotnet Extension for Test Explorer

  • JetBrains Resharper Ultimate 2019.2 (Currently Disabled)

  • Reactive Extensions for Windows 8

  • Reactive Extensions for Windows 8 - Test

  • Reactive Extensions for Windows Phone 8



The ones I've marked "(PPT)" are just the sub extensions of the Productivity Power Tools.

My only thought is perhaps it's something related to IntelliCode? I've only just started using that this year for the first time, so it's something I'm less familiar with so far.

Edited by - nitz on Sep 16 2019 07:21:35 AM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
16086 Posts

Posted - Sep 17 2019 :  11:01:04 AM  Show Profile  Reply with Quote
I have been able to reproduce the problem once more, but so far only once. I don't need to install any extra extensions, and my working theory is that the problem is related to having Windows 10 automatically install Windows updates, specifically .NET updates, in the background, perhaps while the IDE is actually running...

I am trying to pin down a way to test this now. If the trigger is somewhat delicate, it would explain why most people never notice this effect.

zen is the art of being at one with the two'ness
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
16086 Posts

Posted - Sep 17 2019 :  12:42:11 PM  Show Profile  Reply with Quote
Sadly no progress reproducing this on demand. I suspect there is a timing element, something has to happen "just so" to get VA confused like this. But that does not explain why you seem to be seeing the problem more often, more easily.

At least I can fairly safely eliminate any of your extensions as obvious triggers, which is something.

If this keeps on happening can you please keep an eye out for any obvious signs of what might be triggering this? If it is dependent on installing Windows or IDE updates, that complicates the testing process a bit.

zen is the art of being at one with the two'ness
Go to Top of Page

nitz
Junior Member

16 Posts

Posted - Sep 17 2019 :  1:09:46 PM  Show Profile  Reply with Quote
I do typically keep VS open all the time, so updates definitely would have been installed while it was open. I've got it set that I've got to initiate the windows updates before they download/install, so next time I see a .NET one come through I'll see how it behaves before and after! (Of course, no idea when those might come down the pipe, haha!)

Thanks for your help in trying to track it down! At least rebuilding the symbol database seems to be a workaround for the time being!
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
16086 Posts

Posted - Sep 18 2019 :  07:05:55 AM  Show Profile  Reply with Quote
The fact that I have now managed to catch this bug happening twice suggests it isn't super hard to trigger, but I don't think anyone else has reported this yet, so perhaps they are just not running into it. I will keep an eye out for this, it would be good to have a test case to study.

zen is the art of being at one with the two'ness
Go to Top of Page

nitz
Junior Member

16 Posts

Posted - Sep 18 2019 :  09:52:07 AM  Show Profile  Reply with Quote
Low and behold, I got a windows update with a .NET Framework change! (KB4514359 picture: https://i.imgur.com/n7wpZ5z.png)

Visual studio running while I installed updates. Updates wanted a restart.

I tried restarting just visual studio first, but then the PC as well, and the behavior didn't change. Now, this project is targeting 4.7.2, and the update was for 3.5 and 4.8, so that might have something to do with it (but IIRC the 3.5 runtime is still what 4.7.2 is running on, so I'm not sure.)

Either way, that particular one didn't seem to trigger it this time.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
16086 Posts

Posted - Sep 18 2019 :  11:46:23 AM  Show Profile  Reply with Quote
Similar to what I am seeing here. I have a virtual machine that is normally not on the network, so it was a couple of weeks behind on updates. I tried installing the Windows .NET updates both with the IDE open and closed, and no problem.

But I did see the problem happen once on this machine, with it connected to the network and left idle for a bit. Unfortunately I forgot to save out it's problem state before doing any more testing.

zen is the art of being at one with the two'ness
Go to Top of Page
   Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2019 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000