System.Data throws NotSupportedException on iOS Unity Build
Asked Answered
S

1

0

I want to use DataTable class on iOS. I am implementing DataTable class as you see in the code. It works fine on Android and Standalone builds with Unity. I cannot figure it out why iOS is not woking. The interesting part is the early version of this app works fine on all platforms. Is there any idea how to dig in to the issue? I check the build folder on Xcode and I see the System.Data.dll on the resources folder so the is no optimization stripped all necessary files are included.

DataTable dataTable = new DataTable("Example Table Name");

    DataColumn column;
    DataRow row;
    Debug.Log("Datarow and column created");
    // Create new DataColumn, set DataType, 
    // ColumnName and add to DataTable.
    column = new DataColumn
    {
        DataType = Type.GetType("System.String"),
        ColumnName = "foo",
        ReadOnly = false,
        Unique = false
    };
    Debug.Log("First column created");
    dataTable.Columns.Add(column);

When i build on iOS on console i see the first debug log message then throw this exception.

    Log: NotSupportedException: linked away Stack: System.Data.DataCommonEventSource.ExitScope (System.Int64 scopeId) (at <00000000000000000000000000000000>:0)
System.Data.DataColumn.set_ColumnName (System.String value) (at <00000000000000000000000000000000>:0)
GenelSatisUIController.CreateTable () (at <00000000000000000000000000000000>:0)
GenelSatisUIController.AdHeaderAndValues () (at <00000000000000000000000000000000>:0)
GenelSatisUIController+<GenelSatiRaporTable>d__7.MoveNext () (at <00000000000000000000000000000000>:0)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <00000000000000000000000000000000>:0)

Any help would be greatly appreciated.

Shoup answered 15/6, 2020 at 13:29 Comment(4)
so the issue seems to be ColumnName = ... maybe related to When a DataColumn is created, it has no ColumnName value. However, when the DataColumn is added to a DataColumnCollection for a DataTable object, it is given a default name ("Column1", "Column2", and so on). (from DataColumn)Edana
Yes it seems three is an issue about column name but it is not make any sense. I tried different names also :) nothing change.Zendavesta
I will trying to add the column to DataColumnCollection then give it a name. I will write the result.Zendavesta
When i tried to add the column to the collection then set column name throws the same exception.Zendavesta
S
0

I do not fully understand why but when i changed the implementation like this it works fine. May be it will help somebody.

 DataTable dataTable = new DataTable("Genel Satış Raporu");

    DataColumn column;
    DataRow row;
    Debug.Log("Datarow and column created");
    // Create new DataColumn, set DataType, 
    // ColumnName and add to DataTable.

    column = new DataColumn("Grup Adı", Type.GetType("System.String"));

    dataTable.Columns.Add(column);

    column = new DataColumn("Adet", Type.GetType("System.String"));

    dataTable.Columns.Add(column);

    column = new DataColumn("Tutar", Type.GetType("System.Double"));

    dataTable.Columns.Add(column);
Shoup answered 15/6, 2020 at 20:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.