System.Data throws NotSupportedException on iOS Unity Build

那年仲夏 提交于 2020-07-10 08:28:05

问题


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.


回答1:


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);


来源:https://stackoverflow.com/questions/62389253/system-data-throws-notsupportedexception-on-ios-unity-build

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!