Blog Stats
  • Posts - 61
  • Articles - 3
  • Comments - 223
  • Trackbacks - 234

 

Sunday, May 21, 2006

The One with the Bad DataSet/XSD day

Original post at my blog

As if usual problems arent complex enough my Visual Studio 2005 stopped displaying DataSet's that were designed and were working very recently. When I open my visual studio solution / project which already has an DataSet open I will get the following error dialog


[
Load DataSet Error
Failed to load dataset because of the following error:

Value cannot be null.
Parameter name: project
]

and the following error message

 

One or more errors encountered while loading the designer. The errors are listed below. Some errors can be fixed by rebuilding your project, while others may require code changes.


Value cannot be null. Parameter name: project

Hide    


at Microsoft.VSDesigner.VSDesignerPackage.GlobalConnectionService.Microsoft.VSDesigner.VSDesignerPackage.IGlobalConnectionService.GetConnections(IServiceProvider serviceProvider, Project project)
at Microsoft.VSDesigner.DataSource.DesignConnection.GetConnectionFromAppSettings(String objectName, String propertyName)
at Microsoft.VSDesigner.DataSource.DesignConnection.get_ConnectionStringObject()
at Microsoft.VSDesigner.DataSource.DbSource.set_Connection(IDesignConnection value)
at Microsoft.VSDesigner.DataSource.DesignDataSource.SetConnectionProperty(Source source)
at Microsoft.VSDesigner.DataSource.DesignDataSource.ReadXmlSchema(DataSourceXmlTextReader xmlReader)
at Microsoft.VSDesigner.DataSource.DesignDataSource.ReadXmlSchema(TextReader textReader)
at Microsoft.VSDesigner.DataSource.Designer.DataSourceSerializationService.DeserializeToDataSource(String filePath, Object serializationData)
at Microsoft.VSDesigner.DataSource.ProjectDataSourceDescriptor.LoadDataSource()
at Microsoft.VSDesigner.DataSource.ProjectDataSourceDescriptor.Init(IServiceProvider provider, IVsHierarchy primaryHierarchy, UInt32 primaryItemId, Object primaryDocDataObject, UInt32 docCookie, IVsInvisibleEditor invisibleEditor, IDesignerHost host)
at Microsoft.VSDesigner.DataSource.ProjectDataSourceStorage.EnsureInvisibleEditor(ProjectItem dsProjectItem, Boolean ensureWritable, Boolean createInvisibleEditor)
at Microsoft.VSDesigner.DataSource.ProjectDataSourceStorage.GetDataSourceInternal(Object caller, ProjectItem dsProjectItem, Boolean ensureWritable, Boolean createInvisibleEditor)
at Microsoft.VSDesigner.DataSource.Designer.DataSourceDesignerLoader.HandleLoad(IDesignerSerializationManager serializationManager)

Occording to SOP, first I closed the dataset file (xsd) and tried opening it again in the editor, at which time I would get another error message in the following format:


[
Load DataSet Error
Failed to load dataset because of the following error:

Object reference not set to an instance of an object
]

and the following error message

 

One or more errors encountered while loading the designer. The errors are listed below. Some errors can be fixed by rebuilding your project, while others may require code changes.


Object reference not set to an instance of an object.

Hide    


at Microsoft.VisualStudio.DataTools.Providers.OleDB.OleDBUtilities.GetRegisteredProviders()
at Microsoft.VisualStudio.DataTools.Providers.OleDB.OleDBUtilities.ExpandProvider(String provider)
at Microsoft.VisualStudio.DataTools.Providers.OleDB.OleDBUtilities.GetDataSource(String provider)
at Microsoft.VisualStudio.DataTools.Providers.OleDB.OleDBDataSourceSpecializer.DeriveDataSource(String connectionString)
at Microsoft.VisualStudio.DataTools.DataServices.DataProvider.DeriveDataSource(String connectionString)
at Microsoft.VSDesigner.Data.ProviderManager.GetVsDataSource(String invariantName, String connectionString, Boolean encrypted)
at Microsoft.VSDesigner.Data.ConnectionString..ctor(String providerName, String connectionString)
at Microsoft.VSDesigner.VSDesignerPackage.AppSettingsHelper.GetConnectionsViaDataEnvironment(IDataEnvironment dataEnvironment)
at Microsoft.VSDesigner.VSDesignerPackage.GlobalConnectionService.Microsoft.VSDesigner.VSDesignerPackage.IGlobalConnectionService.GetConnections(IServiceProvider serviceProvider, Project project)
at Microsoft.VSDesigner.DataSource.DesignConnection.GetConnectionFromAppSettings(String objectName, String propertyName)
at Microsoft.VSDesigner.DataSource.DesignConnection.get_ConnectionStringObject()
at Microsoft.VSDesigner.DataSource.DbSource.set_Connection(IDesignConnection value)
at Microsoft.VSDesigner.DataSource.DesignDataSource.SetConnectionProperty(Source source)
at Microsoft.VSDesigner.DataSource.DesignDataSource.ReadXmlSchema(DataSourceXmlTextReader xmlReader)
at Microsoft.VSDesigner.DataSource.DesignDataSource.ReadXmlSchema(TextReader textReader)
at Microsoft.VSDesigner.DataSource.Designer.DataSourceSerializationService.DeserializeToDataSource(String filePath, Object serializationData)
at Microsoft.VSDesigner.DataSource.ProjectDataSourceDescriptor.LoadDataSource()
at Microsoft.VSDesigner.DataSource.ProjectDataSourceDescriptor.Init(IServiceProvider provider, IVsHierarchy primaryHierarchy, UInt32 primaryItemId, Object primaryDocDataObject, UInt32 docCookie, IVsInvisibleEditor invisibleEditor, IDesignerHost host)
at Microsoft.VSDesigner.DataSource.ProjectDataSourceStorage.EnsureInvisibleEditor(ProjectItem dsProjectItem, Boolean ensureWritable, Boolean createInvisibleEditor)
at Microsoft.VSDesigner.DataSource.ProjectDataSourceStorage.GetDataSourceInternal(Object caller, ProjectItem dsProjectItem, Boolean ensureWritable, Boolean createInvisibleEditor)
at Microsoft.VSDesigner.DataSource.Designer.DataSourceDesignerLoader.HandleLoad(IDesignerSerializationManager serializationManager)

On the quest to solve this headache I hit google and came up with the following pages which kind of had content related to the problem:

http://www.darrellhawley.com/2006/05/value-cannot-be-null-parameter-name.html - He was lucky to have the problem sorted out on the first step of SOP, but as you know our problems never are that easy to solve, are they? :)

http://www.kbalertz.com/kbNamed_894438/Describes.problem.that.occurs.Microsoft.Visual.Studio.When.open.project.that.contains.inherited.user.receive.error.aspx - Even though this page had a similar error message tackled, it was not the same as the current one.

Then finally hit on this forum post http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=133896&SiteID=1 it is quite long (4 pages), but was worth it. After a to and forth conversation which spanned 3 pages Stephen Provine had nailed the problem to a missing registry key value.

The culprit was Windows Live Safety Scanner - "Clean Up Scan", yup! the safety centre had cleaned out the unwanted registry keys, which is usually good for the system in most cases but this time it was not one of those "most" cases.

To fix the problem please follow the following steps:

To examine the registry:

1) Run regedit.exe;
2) Browse to the location "HKEY_CLASSES_ROOT\CLSID\{F9AE8980-7E52-11d0-8964-00C04FD611D7}" in the tree;
3) If there is a child node in the tree called "ProgID", then you are indeed experiencing a different problem - let me know if this is the case.

Otherwise, follow these steps to modify the registry:

1) Right click the node and select "New > Key";
2) Enter "ProgID" as the name;
3) Go to the main window and double click "(Default)";
4) Enter the value "MSIDXS.1";

Now if you run Visual Studio, it should be working.

Hope this helps out a fellow developer who is on his way to becoming a hairless monk!

Update: Because of the use of tables and stylesheets the article was not showing up properly, now I have fixed them and updated the post, hopefully this works good.

 

 

Copyright © CodeCanvas