Comments (18)
From @karelz on April 29, 2017 8:12
If VS changes are needed (which is IMO likely), there will be accompanying VS update.
I wonder if this is more related to Desktop magic retargeting pack (or whatever we call it) -- @weshaggard @ericstj?
from winforms.
From @danmosemsft on April 30, 2017 0:20
from winforms.
From @weshaggard on May 1, 2017 17:13
Eventually we will likely have VS designer support for .NET Core components but I don't expect that to come online in the next VS update. Most of the Component design is around WinForms and WPF support which is not a target for .NET Core (at least not at this time).
The errors you are seeing are related to the fact that the inbox .NET Framework doesn't know about most of these .NET Core assembly identities so your assumption of the mixing between .NET Framework and .NET Core is the reason this scenario is broken.
from winforms.
From @karelz on May 1, 2017 18:13
Seems to be answered by @weshaggard, closing. Please let us know if you need more info (we can reopen again), thanks!
from winforms.
@terrajobst will probably chat separately about designer story in Core. The 2.0 data designer does (just about) work today and it aligns with .NET Core goals.
from winforms.
i've got a winforms app that references a project library that is dual targeted to net452 and netstandard2.0 (via <TargetFrameworks>netstandard2.0;net452</TargetFrameworks>
) and the forms designer shows the exception page with the error:
Could not load file or assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
The referenced library has no winforms dependencies. Removing netstandard2.0 from the TargetFrameworks makes the designer work again.
This seems like a bug in VS.
from winforms.
Have you tried changing this:
<TargetFrameworks>netstandard2.0;net452</TargetFrameworks>
to this:
<TargetFrameworks>net452;netstandard2.0</TargetFrameworks>
@davkean would know more but my understanding is that the pieces in VS that aren't aware of multi-targeting will use the first framework in that list.
from winforms.
@terrajobst ack.... YES it did fix it (i needed to rebuild the project / restart VS). Thank you!
from winforms.
In that case my entire expertise can be summarized as π€·ββοΈ π . Presumably, there is work left in the project system/MSBuild to light up the designers properly for that case then.
from winforms.
Oops, didn't mean to close this.
from winforms.
Hello,
This is the closest thing I have found that I believe relates to an issue I have when attempting to run a dotnet core 3.1 application. After porting an existing Window Forms application to dotnet 3.1 I receive this when attempting to run the application:
G:\Ham Radio\ominaSDR\Hardware\Linux\dotnettest\mscc\Release\netcoreapp3.1>dotnet mscc.dll
Unhandled exception. System.Resources.MissingManifestResourceException: Could not find the resource "OmniaGUI.Main_form.resources" among the resources "mscc.Properties.Resources.resources" embedded in the assembly "mscc", nor among the resources in any satellite assemblies for the specified culture. Perhaps the resources were embedded with an incorrect name.
at System.Resources.ManifestBasedResourceGroveler.HandleResourceStreamMissing(String fileName)
at System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet(CultureInfo culture, Dictionary`2 localResourceSets, Boolean tryParents, Boolean createIfNotExists)
at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)
at System.Resources.ResourceManager.GetString(String name, CultureInfo culture)
at System.Resources.ResourceManager.GetString(String name)
at OmniaGUI.Main_form.InitializeComponent() in G:\Ham Radio\ominaSDR\Hardware\Linux\dotnettest\mscc\Main_Form.designer.cs:line 1403
at OmniaGUI.Main_form..ctor() in G:\Ham Radio\ominaSDR\Hardware\Linux\dotnettest\mscc\Main_Form.cs:line 105
at OmniaGUI.Program.Main() in G:\Ham Radio\ominaSDR\Hardware\Linux\dotnettest\mscc\Program.cs:line 20
Since I am 100% new to dotnet core, it is most likely an issue with my port, but I am at a lost on how to correct the issue.
Regard,s
Ron
P.S. I am not intentionally attempting to high jack this thread, but really looks like a good place to start. Please let me know if I should start new issue.
from winforms.
@w4mmp Start a new bug over http://github.com/microsoft/msbuild. This is likely related to the way we control how we embed resources files in the resulting binary based on the presence/non-presence of source files, ie the feature called out in dotnet/msbuild#4488. It might not be working your case - post the project file as part of the bug.
from winforms.
Hello,
Thanks for getting back to me so quickly. I will start a new issue in msbuild.
Cheers,
Ron
from winforms.
Current status:
I tried the following in class libraries targeting various versions of .NET Standard, .NET Core, and .NET on build 16.9.0 Preview 3.0 [30730.33.main]:
- Create a C# class library.
- Right-click on the project, choose Add | New Item..., and add a "Component Class" item.
- Right-click on the newly-added "Component1.cs" class and choose "View Designer".
Results:
.NET Standard 2.0
The designer "opens" with the white screen of death and the error "Unsupported type argument in custom attribute signature". Call stack:
at Microsoft.MetadataReader.SignatureUtil.GetTypeId(Type type)
at Microsoft.MetadataReader.MetadataOnlyModule.GetConstructorArguments(ConstructorInfo constructorInfo, Byte[] customAttributeBlob, Int32& index)
at Microsoft.MetadataReader.MetadataOnlyModule.LazyAttributeParse(Token token, ConstructorInfo constructorInfo, IList`1& constructorArguments, IList`1& namedArguments)
at Microsoft.MetadataReader.MetadataOnlyCustomAttributeData.get_ConstructorArguments()
at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkUtil.ConstructAttribute(CustomAttributeData data)
at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkUtil.GetCustomAttributes(ICustomAttributesDataProvider member, Type filter, CustomAttributesCache cache)
at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkUtil.GetCustomAttributes(Type type, Type filter, Boolean inherit, CustomAttributesCache cache)
at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkType.GetCustomAttributes(Type filter, Boolean inherit)
at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkAttributeCollection.GetAttributes(Type type, Type filter)
at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkAttributeCollection.GetAttributes(MemberInfo member, Type filter)
at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkAttributeCollection.get_Attributes()
at Microsoft.VisualStudio.Design.VSDesignSurface.EnsureExtensions(IComponent component)
at Microsoft.VisualStudio.Design.VSDesignSurface.CreateInstance(Type type)
at System.ComponentModel.Design.DesignerHost.System.ComponentModel.Design.IDesignerHost.CreateComponent(Type componentType, String name)
at System.ComponentModel.Design.Serialization.DesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.DesignerSerializationManager.System.ComponentModel.Design.Serialization.IDesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, CodeTypeDeclaration declaration)
at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
at System.ComponentModel.Design.Serialization.BasicDesignerLoader.BeginLoad(IDesignerLoaderHost host)
.NET Standard 2.1
As with .NET Standard 2.0, you get the white screen of death but with a different error: "Value cannot be null. Parameter name: instance". Call stack:
at System.ComponentModel.TypeDescriptor.AddAttributes(Object instance, Attribute[] attributes)
at Microsoft.VisualStudio.Design.VSDesignSurface.CreateDesigner(IComponent component, Boolean rootDesigner)
at System.ComponentModel.Design.DesignerHost.AddToContainerPostProcess(IComponent component, String name, IContainer containerToAddTo)
at System.ComponentModel.Design.DesignerHost.PerformAdd(IComponent component, String name)
at System.ComponentModel.Design.DesignerHost.System.ComponentModel.Design.IDesignerHost.CreateComponent(Type componentType, String name)
at System.ComponentModel.Design.Serialization.DesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.DesignerSerializationManager.System.ComponentModel.Design.Serialization.IDesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, CodeTypeDeclaration declaration)
at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
at System.ComponentModel.Design.Serialization.BasicDesignerLoader.BeginLoad(IDesignerLoaderHost host)
.NET Core 3.1
You get an "Opening the file..." dialog for a few seconds, and then nothing--the designer doesn't open at all.
.NET 5
You get an "Opening the file..." dialog for a few seconds, and then nothing--the designer doesn't open at all.
from winforms.
I'm going to move this to dotnet/winforms as I don't think these problems have anything in particular to do with the project system.
from winforms.
The component designer is currently being worked on, and it is currently expected to become available in 16.9 GA.
With that only .NET Core 3.1 and .NET 5.0 scenario will work. Windows Forms does not support anything earlier than that.
from winforms.
Perhaps the issue I filed in Developer Community 'WinForms Designer Uses Assembly from Wrong Target Framework of a Project Dependency' is related to this? Perhaps we are talking about different issues with a similar workaround.
@davkean - I do suspect at least my issue may be related to Project System. If an SDK-style multitargeted library project βAβ is referenced by another project βBβ (any project file-type), Form or UserControl classes in project βBβ that inherit from types in βAβ can fail to load in the designer if netstandard2.0 is listed first in in project βAβ, and the inherited WinForm types are excluded from the netstandard2.0 compilation. I'd expect that in the case of project B, as an SDK style project, would select a more appropriate target than netstandard from 'A' regardless of ordering. If 'A' is built into a nuget package, and switched from a project reference to package reference, 'B' will not select the netstandard variant and the designer functions properly - so there is certainly a behavioral difference between these reference types.
Sadly, in my case a reorder workaround is not possible without extra work as this project is also referenced by a Xamarin project which (of course) needs to have netstandard as the first target framework. The only workaround is to change the order in 'A', restart visual studio, design, then revert the order back if compilation with a Xamarin reference is required.
This can be seen in Visual Studio 2019 16.9.2 and 16.10.0 Preview 1.0
from winforms.
This doesn't appear to be an issue in VS 2022.
from winforms.
Related Issues (20)
- [dotnet-sdk-9.0.100-preview.4.24223.3] When launch Analogy.LogViewer, it shows error βThe type initializer for 'FormIconHelper' threw an exceptionβ. HOT 7
- Inconsistency in Persistence of Property Values with DesignerSerializationVisibility between .NET Framework and .NET Core. HOT 8
- The description for design properties within DemoControl application is not appearing for every control. HOT 2
- System.Private.Windows.Core is not included in the runtime pack HOT 7
- ContextMenuStrip show on wrong monitor HOT 6
- Cell using 'DisplayMember' to find and set value resulting in setting bad value. HOT 6
- System.Data.DataColumn serializes some properties with a default value (different from the .NET Framework) HOT 1
- Using WinForms Controls provided via NuGet inside the Out-Of-Process Designer without copying them to the build output HOT 5
- Unstable unit test: System.Windows.Forms.Tests.DataGridViewTests.DataGridView_OnColumnHeadersHeightChanged_InvokeWithHandle_CallsColumnHeadersHeightChanged(columnHeadersWidthSizeMode: EnableResizing, columnHeadersVisible: True, eventArgs: null)
- Unstable unit test: System.Windows.Forms.UITests.ButtonTests.Button_DialogResult_SpaceToClickFocusedButtonAsync
- Unstable unit test: System.Windows.Forms.UITests.ButtonTests.Button_Hotkey_Fires_OnClickAsync
- Unstable unit test: System.Windows.Forms.UITests.ButtonTests.Button_CancelButton_EscapeClicksCancelButtonAsync
- Unstable unit test: System.Windows.Forms.UITests.ButtonTests.Button_Press_Enter_Fires_OnClickAsync
- Unstable unit test: System.Windows.Forms.UITests.ListViewTests.ListView_Group_NavigateKeyboard_SucceedsAsync
- Unstable unit test: System.Windows.Forms.UITests.NumericUpDownTests.NumericUpDownAccessibleObject_Focused_ReturnsCorrectValueAsync
- WinForms fails to build with a nightly SDK HOT 2
- Massive GDI (region) leak. Help needed. HOT 9
- Unresponsiveness issue during Real-Time Updates in Winforms DataGridView HOT 3
- [ARM64]The Form1.cs[Design] page cannot load successfully after installed the latest .NET 9.0 Preview4 or Preview5 HOT 3
- GDI/BitBlt features for .NET Core? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from winforms.