Bug? SmartString compiler bug (?)

Mike1970

Well-Known Member
Licensed User
Longtime User
Hi everyone, i was using the UDPSocket to send some packets to my server.
I noticed something weird, if i try to compile my code the compiler crashes saying:

The following build commands failed: CompileC /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/arm64/b4i_main.o /Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_main.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (1 failure)

B4X:
Sub Button1_Click
    For i=0 To 100
        UDPSocket1.Initialize("UDP", 0, 2048)
        Dim Packet As UDPPacket
    
        Dim data() As Byte
        If i==0 Then
            data = "Start".GetBytes("UTF8")
        Else
            data = $"${i}"$.GetBytes("UTF8")
        End If
    
    
        Packet.Initialize(data, "79.54.92.196", 12000)
        UDPSocket1.Send(Packet)
        Sleep(300)
    Next
End Sub
The error is in the line 10 ⬆


BUT if i compile the code like so, it works:
B4X:
Sub Button1_Click
    For i=0 To 100
        UDPSocket1.Initialize("UDP", 0, 2048)
        Dim Packet As UDPPacket
    
        Dim data() As Byte
        If i==0 Then
            data = "Start".GetBytes("UTF8")
        Else
            data = "".GetBytes("UTF8")
        End If
    
    
        Packet.Initialize(data, "79.54.92.196", 12000)
        UDPSocket1.Send(Packet)
        Sleep(300)
    Next
End Sub

The problem is that, AFTER the app is already running in debug, if i change the line from:
B4X:
data = "".GetBytes("UTF8")
to
B4X:
data = $"${i}"$.GetBytes("UTF8")
and then i hit CTRL+S it works!!!!

What is happening?
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…