This code worked in the debugger on my iMac ever since 2019R1 stopping at the second conditional Break statement and finishing to the Return after that if I let it go that far. It hangs now after the latest update, apparently never reaching either of the two conditional “Break” statements. Why is this happening now?
If MaxUInt32 = 0 Then
Initialize
End If
Var iril As UInteger = iri.Length
Var result As Text = ""
Var handledCount, basicCount, bias, n, m, q, k, t, delta As UInt32
Var outputCount As UInteger = 0
n = INITIAL_N
bias = INITIAL_BIAS
delta = 0
For Each cp As UInt32 In iri.Codepoints
If (cp > &h10FFFF) Or (cp >= &hD800 And _
cp <= &hD8FF) Then
#If DebugBuild
Break
#Else
Raise New IllegalInputException
#EndIf
Elseif IsBasicCodepoint(cp, False) Then
result = result + Text.FromUnicodeCodepoint(cp)
outputCount = outputCount + 1
End If
Next
handledCount = outputCount
basicCount = outputCount
If basicCount > 0 Then
result = result + Text.FromUnicodeCodepoint(DELIMITER)
End If
While handledCount < iril
m = MaxUInt32
For Each cp As UInt32 In iri.Codepoints
If cp >= n And cp < m Then
m = cp
End If
Next
If (m - n) > ((MaxUInt32 - delta) \ (handledCount + 1)) Then
#If DebugBuild
Break
#Else
Raise New OverflowException
#EndIf
delta = delta + ((m - n) * (handledCount + 1))
n = m
For Each cp As UInt32 In iri.Codepoints
If cp < n And delta + 1 > MaxUInt32 Then
#If DebugBuild
Break
#Else
Raise New OverflowException
#EndIf
End If
If cp = n Then
k = BASE
q = delta
While True
If k <= bias Then
t = T_MINIMUM
Elseif k >= (bias + T_MAXIMUM) Then
t = T_MAXIMUM
Else
t = k - bias
End If
If q < t Then
Exit While
End If
result = result + EncodeDigit(t + (q - t) Mod (BASE - t), _
lowercaseResult)
#If DebugBuild
If result.Length = 4 Then Break
#EndIf
q = (q - t) \ (BASE - t)
k = k + BASE
Wend
result = result + EncodeDigit(q, lowercaseResult)
#If DebugBuild
If result.Length = 4 Then Break
#EndIf
bias = AdaptForBias(delta, handledCount + 1, _
(handledCount = basicCount))
delta = 0
handledCount = handledCount + 1
End If
Next
delta = delta + 1
n = n + 1
End If
Wend
Return result