Input code
https://github.com/Lightning-Forge-Games/uGUI/blob/8686abb727366154be46c3062c24cfe5183d3d4e/com.unity.ugui/Runtime/TMP/TMP_FontAsset.cs#L619-L625
if (texFormat == TextureFormat.Alpha8)
tmp_material = new Material(ShaderUtilities.ShaderRef_MobileBitmap);
else
tmp_material = new Material(Shader.Find("TextMeshPro/Sprite"));
//tmp_material.name = texture.name + " Material";
tmp_material.SetTexture(ShaderUtilities.ID_MainTex, texture);
Erroneous output
Instead of doing if else, it decompiles as ternarny conditional, and desyncs the IL when using mixed.
// material = ((textureFormat != TextureFormat.Alpha8) ? new Material(Shader.Find("TextMeshPro/Sprite")) : new Material(ShaderUtilities.ShaderRef_MobileBitmap));
IL_00a8: ldloc.1
IL_00a9: ldc.i4.1
IL_00aa: bne.un.s IL_00ba
IL_00ac: call class [UnityEngine.CoreModule]UnityEngine.Shader TMPro.ShaderUtilities::get_ShaderRef_MobileBitmap()
IL_00b1: newobj instance void [UnityEngine.CoreModule]UnityEngine.Material::.ctor(class [UnityEngine.CoreModule]UnityEngine.Shader)
IL_00b6: stloc.s 4
// (no C# code)
IL_00b8: br.s IL_00cb
// material.SetTexture(ShaderUtilities.ID_MainTex, texture2D);
IL_00ba: ldstr "TextMeshPro/Sprite"
IL_00bf: call class [UnityEngine.CoreModule]UnityEngine.Shader [UnityEngine.CoreModule]UnityEngine.Shader::Find(string)
IL_00c4: newobj instance void [UnityEngine.CoreModule]UnityEngine.Material::.ctor(class [UnityEngine.CoreModule]UnityEngine.Shader)
IL_00c9: stloc.s 4
IL_00cb: ldloc.s 4
IL_00cd: ldsfld int32 TMPro.ShaderUtilities::ID_MainTex
IL_00d2: ldloc.2
IL_00d3: callvirt instance void [UnityEngine.CoreModule]UnityEngine.Material::SetTexture(int32, class [UnityEngine.CoreModule]UnityEngine.Texture)
Expected decompilation
Example is from using DnSpyEx v6.5.1

Details
- Product in use: ILSpy 10.0 Preview 2
- Version in use: Latest one, but same problem is also on older versions.
- The correct behaviour happens on DnSpyEx.
Input code
https://github.com/Lightning-Forge-Games/uGUI/blob/8686abb727366154be46c3062c24cfe5183d3d4e/com.unity.ugui/Runtime/TMP/TMP_FontAsset.cs#L619-L625
Erroneous output
Instead of doing if else, it decompiles as ternarny conditional, and desyncs the IL when using mixed.
Expected decompilation
Example is from using DnSpyEx v6.5.1

Details