dotnet / dotnet/winforms

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

Open
#8,348 6 comments 0 reactions 1 assignee Assigned to @Olina-Zhang View on GitHub
area-VSDesigner
Dominant language
C#
Stars
4.9k
Forks
1.1k
Avg merge
1d 13m
Merged PRs (30d)
85

Description

### 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](https://github.com/KlausLoeffelmann/NetControlDesigners/pull/6) 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:
```cs
internal class ImageValueEditor : FileNameEditor
{
public override bool GetPaintValueSupported(ITypeDescriptorContext context)
{
return true;
}
}
```
Error:
![image](https://user-images.githubusercontent.com/17767561/206309144-099e1c18-d315-4597-86b9-7b4d203cd147.png)

Must be:
![image](https://user-images.githubusercontent.com/17767561/206309055-c1d702a5-5ab8-4186-9a90-d6ddab49a78d.png)

### 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](https://github.com/kirsan31/winforms-datavisualization/compare/kirsan31:winforms-datavisualization:DesignerTest...DesignerNotWork) 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](https://user-images.githubusercontent.com/17767561/203862352-4a0f36ad-87ba-47c1-a929-ba33b1bbee4a.png)
_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](https://user-images.githubusercontent.com/17767561/203863403-f3687942-a62b-432a-b83c-b0da3c0d3724.png)
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 :(~~

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.