Skip to content

EAccessViolation when attempting to compile via CLI #117

Closed

Description

@VitalRus95

When I try to compile a small code (.txt) to .cs using command line in Sanny Builder, I get “Access violation” error.

Error screenshot:

SB_error

Script source code:

{$CLEO .cs}
    0000:
    repeat
    wait 0
    until player.Defined(0)
    player.Money(0) += 500
    018C: play_sound 1054 at 0.0 0.0 0.0
    0A93: terminate_this_custom_script

This source file can be compiled perfectly fine if manually open in SB. But when it is compiled through CLI, the resulting .cs gets somehow corrupted: the script actually works in the game but its decompiled code is full of some trash:
PyTest.txt

Additional information:

  • Tested on SB ver. 3.6.2 and 3.5.1.
  • Launched in .py, cmd, and sanny.exe shortcut.
  • Launching as admin didn't help.
  • The launch command in the shortcut is the following: "C:\Program Files (x86)\Sanny Builder 3\sanny.exe" -m sa --no-splash -c "D:\Games\GTA SA\CLEO\PyTest.txt" "D:\Games\GTA SA\CLEO\PyTest.cs".
  • Attempting to compile with SB v3.6.2 installed on D: drive yielded the same result.
  • Attempting to compile from .txt with UTF-8 with BOM encoding results in this absurd:
    PyTest.txt

Me and @wmysterio have struggled with this problem for some time but we didn't manage to find a solution yet. Thanks for any help!

Activity

  1. x87 commented on Dec 21, 2020

    @x87
    Collaborator

    @VitalRus95 Confirming this bug.

    As a workaround add {$NOSOURCE} at the top of your script and it should compile.

  2. added
    priority:p2
    type:bug
    workaround-available
    on Dec 21, 2020
  3. wmysterio commented on Dec 22, 2020

    @wmysterio

    I tested with {$NOSOURCE}. SB saved file with encoding ASCII (maybe). If use his or convert this file to ANSI or UTF-8 without BOM then compiling/decompiling complete successfully. Need answer from @VitalRus95 .

    Vital's file generate compile.log with error: Unknown command п»ї{$CLEO .cs}. This is typical when use UTF-8 (with BOM) encoding. Need try to teach SB to save the source in the desired encoding so as not to use {$NOSOURCE} unnecessarily.

  4. VitalRus95 commented on Dec 22, 2020

    @VitalRus95
    Author

    I tested with {$NOSOURCE}. SB saved file with encoding ASCII (maybe). If use his or convert this file to ANSI or UTF-8 without BOM then compiling/decompiling complete successfully. Need answer from @VitalRus95 .

    Vital's file generate compile.log with error: Unknown command п»ї{$CLEO .cs}. This is typical when use UTF-8 (with BOM) encoding. Need try to teach SB to save the source in the desired encoding so as not to use {$NOSOURCE} unnecessarily.

    Yes, both Python and SB generate .txt with UTF-8 (without BOM) encoding (as indicated in Notepad++). Yet manually it can be both compiled and decompiled without any issues and without {$NOSOURCE}.

  5. VitalRus95 commented on Dec 22, 2020

    @VitalRus95
    Author

    @VitalRus95 Confirming this bug.

    As a workaround add {$NOSOURCE} at the top of your script and it should compile.

    {$NOSOURCE} works nice! No error is thrown, the script gets compiled and decompiled fine. Thanks a lot for this suggestion, I hope it won't be too difficult to eliminate the bug in future versions of SB! Good luck!

  6. added this to the v3.8.0 milestone on Jun 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority:p2scope:compilertype:bugworkaround-available

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions