Cain H
Cain H

Reputation: 91

XSD desigener error Visual Studio 2017

I get the following error if I try to open a .xsd file or create a new one in Visual Studio 2017 its a .net 3.5 project and was working fine before I reinstalled windows and upgraded to visual studio 2017 pro.

This seems to be .net 3.5 specific as I opened another project that's 4.0 and its .xsd opened in designer fine.

To prevent possible data loss before loading the designer, the following errors must be resolved:

Value cannot be null. Parameter name: instance

 Instances of this error (1)  
  1. Hide 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.Add(IComponent component, String name) at System.ComponentModel.Container.Add(IComponent component) at Microsoft.VSDesigner.DataSource.Designer.DataSourceDesignerLoader.HandleLoad(IDesignerSerializationManager serializationManager) at Microsoft.VSDesigner.DesignerFramework.BaseDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager) at Microsoft.VSDesigner.DesignerFramework.BaseDesignerLoader.Microsoft.VisualStudio.TextManager.Interop.IVsTextBufferDataEvents.OnLoadCompleted(Int32 fReload)

Link to error screen shot

Upvotes: 8

Views: 9612

Answers (9)

Sanchez
Sanchez

Reputation: 38

This problem hit me when changed target framework to 4.8. I was able to overcome it by removing all connections from data adapters in XSD (I don't need them, but probably adding new connections will be ok).

Thanks James Laycock for hint about old connection strings.

Upvotes: 0

Giancarlo Molina
Giancarlo Molina

Reputation: 101

Change the target to 4.7.2 and i used the toolbox for dataset in my case

Upvotes: 0

Riki Afifuddin
Riki Afifuddin

Reputation: 51

Because some people still get this error maybe this may help you.

  1. Open the Project (or Website) Property Page (right click on project > Property Pages > Build.
  2. Locate the section where you can choose the .NET Framework version.
  3. If your project is using a .NET Framework lower than 4.7.2, set it to 4.7.2 (change and restart Visual Studio afterwards).
  4. If your project is using the .NET Framework 4.7.2, downgrade it to 4.6.1 (change and restart Visual Studio).

note: link for .NET 4.7.2 (here), and for .NET 4.6.1 (here)

Upvotes: 2

hussain parsaei
hussain parsaei

Reputation: 29

i had a similar problem in vs.2019 when i changed .net to 4.7.2 it's ok!

Upvotes: 0

B.Habibzadeh
B.Habibzadeh

Reputation: 538

I had the same problem.

My project was targeted to Framework 4.6.1.

And to solve it, I changed the target Framework to 4.7.2.

After that I was then able to open all datasets.

Upvotes: 5

Mayzz
Mayzz

Reputation: 176

This post is old but the problem still exists in 2019. So I post my obstervation:

It seems that the problem comes from the fact that on the applications after 2017 (MVC and Webform) the files of DataSet cannot be placed in the directory App_Code.

You can check and move the files to another folder and you will see that the designer can open them without any problem.

The only problem is that by convention on old projects, the code files must be in App_Code, otherwise compile errors will appear.

Upvotes: 3

James Laycock
James Laycock

Reputation: 9

This may be related to a "security" feature that happens when you created the XSD in an older version of Visual Studio and have SQL credentials in the connection string.

Upvotes: 1

Kevinoid
Kevinoid

Reputation: 4850

I'm observing the same symptoms you describe and, as suggested by Tibi, also found that changing the Target Framework to 4.6 (via Website→Start Options→Build for ASP.NET projects) worked for projects where that was feasible.

I found two open issues for this behavior on the Visual Studio Developer Community website:

Neither has a solution (other than the Target Framework 4.6 workaround) nor official feedback after more than 6 months.

Upvotes: 10

Tibi
Tibi

Reputation: 61

Hy! Set your project Target Framework: 4.6 (Right Click the ProjectName/Property Pages/Build/Target Framework--->4.6) I try it, and it's work.

Upvotes: 5

Related Questions