dotnet / winforms

Windows Forms is a .NET UI framework for building Windows desktop applications.
MIT License
4.37k stars 966 forks source link

Designer can't resolve client/server nuget library in some cases depend on assembly name #8348

Open kirsan31 opened 1 year ago

kirsan31 commented 1 year ago

Environment

Microsoft Visual Studio Community 2022 Version 17.4.2 VisualStudio.17.Release/17.4.2+33122.133 Microsoft .NET Framework Version 4.8.09032

.NET version

.Net6 .Net7

Issue description

We had a long investigation and discussion with @KlausLoeffelmann why in chart control I can't use client/server technique of the new designer. When all in one assembly all +- working. When I separate one of the custom editor to client side assembly - this editor stopped working. Same with server when I separate designer and serializer to server side assembly - both stopped working.

For simplicity, we will only check the client side. The editor is simple:

internal class ImageValueEditor : FileNameEditor
{
    public override bool GetPaintValueSupported(ITypeDescriptorContext context)
    {
        return true;
    }
}

Error: image

Must be: image

Steps to reproduce

Pull, build, open Form1 from DesignerTest project in designer, drag chart control to it. The easiest property to test our ImageValueEditor is BackImage property as on screenshots above.

Not working: https://github.com/kirsan31/winforms-datavisualization/tree/DesignerNotWork Working: https://github.com/kirsan31/winforms-datavisualization/tree/0c357fca784c62703918d2bb6e9484a3b72cd817

The only change is rename of main assembly from System.Windows.Forms.DataVisualization to WinForms.DataVisualization.

After this change we have two chart controls on the toolbox: image By the way, this is not always the case, sometimes you have to restart the studio several times in order for the nuget variant to appear. I will create a separate issue on this topic...

But with System.Windows.Forms.DataVisualization assembly name we always had only one control on the toolbox: image So with System.Windows.Forms.DataVisualization main assembly name designer simply can't resolve our package :(


P.s. Can some one from WinForms team some how ping some one from VS team? I have very specific bug with VS on my laptop: https://developercommunity.visualstudio.com/t/Net-local-variables-not-captured-by-deb/10216016 - local variables not captured by debugger at any projects any more :( I tried everything I could find on the Internet and what came up with it myself - nothing helps. It's a real problem and I don't know what to do :(

merriemcgaw commented 1 year ago

Thanks @kirsan31. We'll take a look at this, after the holidays though for sure. I've also made sure to ping the debugger team to help investigate the local variables issue. Question on that - is this also happening in a console app?

kirsan31 commented 1 year ago

@merriemcgaw

Question on that - is this also happening in a console app?

WoW, you are right - the bug WinForms only 😯 Snipaste_2022-12-08_08-40-36

merriemcgaw commented 1 year ago

That's quite the surprise! @Olina-Zhang can you check this in the inproc designer as well as checking for which version of VS might have regressed it, maybe validate WPF apps too? I don't know what we do that would impact the debugging experience but it's surely something we need to figure out.

kirsan31 commented 1 year ago

That's quite the surprise! @Olina-Zhang can you check this in the inproc designer as well as checking for which version of VS might have regressed it, maybe validate WPF apps too? I don't know what we do that would impact the debugging experience but it's surely something we need to figure out.

I'm afraid it won't be easy to find out, because on my PC (win10) everything works correctly (laptop on Win11) + we don't see many reports on this problem :(

I think I'll open a new thread so as not to offtopic here... Done.