Giter Site home page Giter Site logo

Comments (18)

davkean avatar davkean commented on May 17, 2024

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.

davkean avatar davkean commented on May 17, 2024

From @danmosemsft on April 30, 2017 0:20

@davkean

from winforms.

davkean avatar davkean commented on May 17, 2024

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.

davkean avatar davkean commented on May 17, 2024

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.

danmoseley avatar danmoseley commented on May 17, 2024

@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.

coderb avatar coderb commented on May 17, 2024

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.

terrajobst avatar terrajobst commented on May 17, 2024

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.

coderb avatar coderb commented on May 17, 2024

@terrajobst ack.... YES it did fix it (i needed to rebuild the project / restart VS). Thank you!

from winforms.

terrajobst avatar terrajobst commented on May 17, 2024

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.

Pilchie avatar Pilchie commented on May 17, 2024

Oops, didn't mean to close this.

from winforms.

w4mmp avatar w4mmp commented on May 17, 2024

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.

davkean avatar davkean commented on May 17, 2024

@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.

w4mmp avatar w4mmp commented on May 17, 2024

Hello,
Thanks for getting back to me so quickly. I will start a new issue in msbuild.
Cheers,
Ron

from winforms.

tmeschter avatar tmeschter commented on May 17, 2024

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]:

  1. Create a C# class library.
  2. Right-click on the project, choose Add | New Item..., and add a "Component Class" item.
  3. 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.

tmeschter avatar tmeschter commented on May 17, 2024

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.

RussKie avatar RussKie commented on May 17, 2024

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.

StevenBonePgh avatar StevenBonePgh commented on May 17, 2024

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.

RussKie avatar RussKie commented on May 17, 2024

This doesn't appear to be an issue in VS 2022.

from winforms.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.