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. doanlinhit24

    Mar 12, 2019 03:47

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

  2. 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. zdolezal

    Jun 11, 2018 07:10

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

  4. 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. zdolezal

    May 16, 2018 17:26

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

  6. 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. AmazingRuss

    Feb 07, 2018 01:50

    Still happening in 2017.3.0f3

  8. AmazingRuss

    Feb 02, 2018 23:37

    Status changed to "by design"?

    Is there an explanation somewhere?

  9. 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. 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.