Search Issue Tracker

By Design

Votes

13

Found in

2017.1.0p2

Issue ID

937035

Regression

No

TMP InputField throws an InvalidOperationException on WebGL with .NET 4.6

WebGL

-

Steps to reproduce:
1. Open attached project "937035.zip"
2. Make sure that scripting runtime version is set to .NET 4.6
3. Build & run 'ReproScene' for WebGL

Actual result: TextMesh Pro's InputField throws an InvalidOperationException

InvalidOperationException: Operation is not valid due to the current state of the object.
> Rethrow as TypeInitializationException: The type initializer for 'System.Globalization.CharUnicodeInfo' threw an exception.
NullReferenceException: Object reference not set to an instance of an object.

Notes:
Not reproducible with .NET 3.5 scripting runtime version
Not reproducible on Standalone(Windows), UWP(.NET/IL2CPP)

Reproducible with: 2017.1.0b1, 2017.1.0p2, 2017.2.0b5

Fixed in 2018.1.0b3

Comments (15)

  1. 306234d7ab8023c8df40ef785ad5bfe7?d=mm

    doanlinhit24

    Mar 12, 2019 03:47

    thanks ELASTICSEA. textmesh pro worked with me when build in WebGL unity

  2. Da37c8122786e06969aca297cb5c264b?d=mm

    ElasticSea

    Jul 15, 2018 18:28

    Just enable embedded resources for Webgl and that fixes the issue. On how to do it, go here https://forum.unity.com/threads/enabling-embedded-resources-with-webgl.326069/

  3. Affe25a9407c5d09983fa3b9c0233900?d=mm

    zdolezal

    Jun 11, 2018 07:10

    Can we reopen this bug? It's not fixed. Tested in 2018.1.3f1 with latest TMP

  4. C1e4b4c98cd9b2f36fca4b9325038636?d=mm

    Gigacee

    May 17, 2018 17:41

    Same error in Unity 2018.1.0f2. I can't use TextMeshPro on WebGL because of this error.

    InvalidOperationException: Operation is not valid due to the current state of the object.
    at System.Globalization.GlobalizationAssembly.GetGlobalizationResourceBytePtr (System.Reflection.Assembly assembly, System.String tableName) [0x00000] in <00000000000000000000000000000000>:0
    Rethrow as TypeInitializationException: The type initializer for 'System.Globalization.CharUnicodeInfo' threw an exception.


    (Filename: currently not available on il2cpp Line: -1)

  5. Affe25a9407c5d09983fa3b9c0233900?d=mm

    zdolezal

    May 16, 2018 17:26

    Reproduced in 2018.1.0f2, same error with .NET 4.6.2.
    Build with .NET3.5 working.

  6. Da37c8122786e06969aca297cb5c264b?d=mm

    ElasticSea

    Mar 23, 2018 10:11

    Tested on 2018.1.0b11 still the same issue. It happens when string include non latin1(ch <= '\x00ff') characters.

    InvalidOperationException: Operation is not valid due to the current state of the object.
    at System.Globalization.GlobalizationAssembly.GetGlobalizationResourceBytePtr (System.Reflection.Assembly assembly, System.String tableName) [0x00000] in <...>:0
    at System.Globalization.CharUnicodeInfo.InitTable () [0x00000] in <...>:0
    Rethrow as TypeInitializationException: The type initializer for 'System.Globalization.CharUnicodeInfo' threw an exception.
    at System.Char.IsWhiteSpace (System.Char c) [0x00000] in <...>:0
    at TMPro.TextMeshProUGUI.SetArraySizes (System.Int32[] chars) [0x00000] in <...>:0
    at TMPro.TMP_Text.ParseInputText () [0x00000] in <...>:0
    UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
    UnityEngine.DebugLogHandler:LogException(Exception, Object)
    UnityEngine.Logger:LogException(Exception, Object)
    UnityEngine.Debug:LogException(Exception, Object)
    UnityEngine.UI.CanvasUpdateRegistry:PerformUpdate()
    UnityEngine.WillRenderCanvases:Invoke()
    UnityEngine.Canvas:SendWillRenderCanvases()

  7. F554d5d7c36304d4d53bbb72d8927c97?d=mm

    AmazingRuss

    Feb 07, 2018 01:50

    Still happening in 2017.3.0f3

  8. F554d5d7c36304d4d53bbb72d8927c97?d=mm

    AmazingRuss

    Feb 02, 2018 23:37

    Status changed to "by design"?

    Is there an explanation somewhere?

  9. E1d5009c5868810cb6f2de0fa9d846cb?d=mm

    Elringus

    Feb 02, 2018 21:29

    It's happening when constructing CharTable (from System.Globalization). Basically anything involving chars (whitespace detection, trimming, checks for IsChar, etc) will throw the exception.

    I've made a temp fix by using this string.Trim and string.IsEmptyOrWrhitespace instead of the native ones: https://gist.github.com/Elringus/46699e600418e0b3c4ac23cba385dfff

    In Unity 2018.1 it seems to be fixed, though there are some new errors in WebGL builds using .NET 4.6, so I don't think I will be migrating anytime soon.

  10. D5fb0d6df069b0870ab3090486c5f93e?d=mm

    mcmorry

    Jan 19, 2018 21:26

    Fixed only in 2018.1?
    Come on. Please release a patch for 2017.2
    2017.3 doesn't even work well with TextMeshPro!

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.