Visual Studio replaces DataTable with TypedTableBase

377 views Asked by At

Using Visual Studio 2008 in order to compile for Windows Mobile 6 devices, I get an issue where changing anything involved in a DataSet results in the error genasm.exe(1): error There was an error finalizing type. GenericArguments[0], 'Mobile_Verification.ScanData+TRANSRow', on 'System.Data.TypedTableBase1[T] violates the constraint of type parameter 'T'. on the next build.

Selecting this error takes me to Microsoft.CompactFramework.Common.Targets, where there is an error on

<Target
    Name="BuildAsmmeta"
    Condition="'@(None)'!=''">
    <BuildAsmmeta                 <!-- This is where the error is  -->
        .....(contents)
    >

stating The element 'Target' in namespace 'http://schemas.microsoft.com/developer/msbuild/2003' has invalid child element 'BuildAsmmeta' in namespace 'http://schemas.microsoft.com/developer/msbuild/2003'. List of possible elements expected: 'Task, PropertyGroup, ItemGroup, OnError in namespace http://schemas.microsoft.com/developer/msbuild/2003'. Kind of strange for automatically generated code.

On comparing source controlled code to the new code, I find that Visual Studio has changed all instances of

Inherits Global.System.Data.DataTable
Implements Global.System.Collections.IEnumerable

to

Inherits Global.System.Data.TypedTableBase(Of MyRowName)

Now, in the past, when this has popped up, I've been able to just revert my changes so everything is happy. Now, however, I have some changes of substance to make to the dataset, so I would really like to make this not be an issue anymore.

Searching for solutions, however only seems to give fixes going in the opposite direction: Visual Studio forcing a DataSet when a TypedTableBase is expected. Digging in seems to suggest that the issue might have been introduced to our code when we upgraded from .NET CF 2.0 to 3.5. Apparently TypedTableBase is just the way to do things now, and Visual Studio is enforcing the new paradigm. The fixes suggested here do the exact opposite of what I need.

All well and good, except something is apparently broken in the translation. So now I'm left with three options:

  1. Keep manually fixing it every time I need to change the DataSet
  2. Prevent Visual Studio from automatically changing my DataTables to TypedTableBases.
  3. Figure out what is broken in the new TypedTableBase implementation, and fix that. Specifically, since the error is only being thrown in Common.Targets, and there isn't anything showing in my code, what part of my code is it exactly that the auto-generated code is having a problem with, and how do I get it working?

I would try to find any more details to give, but my boss is telling me it's time to get out of the office. If there is anything else that might shed some light, let me know and I can look for it tomorrow.

Thank you.

0

There are 0 answers