Dataset Designer changes namespace in custom partial class - by DavidCat

Status : 

  Postponed<br /><br />
		Due to current priorities, the product team decided to postpone the resolution of this item.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 351958 Comments
Status Closed Workarounds
Type Bug Repros 1
Opened 6/19/2008 8:06:08 AM
Access Restriction Public


In VS2008, the dataset has a separate file (from the .designer.cs) where the user can use a partial class to write custom code.  If this file contains more than one parital class for the dataset, the designer changes the namespace on the second partial class to the namespace of the table adapters.

I have 2 partial classes with the same namespace because one is code generated (custom system) and one is hand crafted code.  Every time I save changes in the dataset (or run custom code), the designer changes the namespace from ProjectName to ProjectName.DataSetNameTableAdapters.

This caused a lot of problems to first diagnosis and causes continuing irration to remember to change the namespace back after generating.

Sign in to post a comment.
Posted by Simon Gymer on 10/3/2008 at 4:18 AM
This is a problem for us too because now we've upgraded to VS2008 configuring our datasets screws up the namespaces and prevents successful compilation. We're now having to manually edit the dataset source whenever we've configured the datasets to correct the namespaces.
Posted by Microsoft on 10/2/2008 at 2:41 PM
Thanks for your response.

Unfortunately when the issue was reported SP1 was in its very last stages and locked down for crit1 fixes only.

In your scenario the designer changes your namespace because it encounters a conflict that is not resolvable: When you click on 'View Code' a second time, where should the designer land the cursor?

One workaround is: Create a new file and copy the code there. That way the designer won't clobber the namespace.
Posted by DavidCat on 9/22/2008 at 7:07 PM
When you create the code behind file for a dataset, it creates a stub of code that is only the namespace. If you copy the namespace section and paste it at the bottom of the file, you now have two namespace entries in the file. When you save the dataset, the second namespace gets changed by VS.

The reason I need two sets of namespace is because one set is generated my my customer code generation system and the other is hand crafted code.

You know it was 4 months ago when I reported the bug. I was hoping the fix would make it into SP1. Now I have to wait another year.
Posted by Microsoft on 9/19/2008 at 4:59 PM
Thanks for providing this feedback. We are investigating this. To help us understand this better, I have a few questions.

1. In step 3 you wrote: "copy all the code and paste below the code to end up with two different namespace and partial class blocks" Can you clarify what code you copied and where specifically you pasted it?

2. Can you describe the goal? What are you hoping to accomplish with the copy-paste?


Milind Lele
PM, Visual Studio
Posted by Microsoft on 7/15/2008 at 2:48 AM
Thanks for your feedback. We are escalating this bug to the product unit who works on that specific feature area. The team will review this issue and make a decision on whether they will fix it or not for the next release.

Thank you,
Visual Studio Product Team