Skip to content
This repository has been archived by the owner on Jan 22, 2022. It is now read-only.

if, integer comparisons fail #39

Closed
MolotovCherry opened this issue May 29, 2020 · 2 comments
Closed

if, integer comparisons fail #39

MolotovCherry opened this issue May 29, 2020 · 2 comments
Labels
not a bug User is doing something that is working as it should, or is that is not yet supported

Comments

@MolotovCherry
Copy link

MolotovCherry commented May 29, 2020

I'm comparing the length of a string in an if statement,

string foo = "foo";
if (foo.Length < 7} {}

While this compiles and runs, the moment the method with this code is invoked, this pops up.

[<color=yellow>UdonBehaviour</color>] An exception occurred during Udon execution, this UdonBehaviour will be halted.
VRC.Udon.VM.UdonVMException: The VM encountered an error!

[<color=#FF00FF>UdonSharp</color>] Myscript.cs: Udon runtime exception detected!
  An exception occurred during EXTERN to 'SystemString.__get_Length__SystemInt32'.

Edit:
So private strings are initialized to null? Can we put something in the documentation warning of the behavior?

@MolotovCherry MolotovCherry added the bug Something isn't working label May 29, 2020
@MerlinVR
Copy link
Owner

MerlinVR commented May 29, 2020

(from discussion on Discord https://discordapp.com/channels/652715801714884620/675466846127915019/715757603862609939) Example code is incomplete and hiding a user error where string fields are defined to be null. This is defined Unity behavior in C# and should not need to be documented here, thanks!

@MerlinVR MerlinVR added not a bug User is doing something that is working as it should, or is that is not yet supported and removed bug Something isn't working labels May 29, 2020
@MolotovCherry
Copy link
Author

Yup. Thanks for the help. My bad as I'm new xD. Appreciate your project! ;)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
not a bug User is doing something that is working as it should, or is that is not yet supported
Projects
None yet
Development

No branches or pull requests

2 participants