vrchat-community / UdonSharp

A compiler for compiling C# to Udon assembly
https://udonsharp.docs.vrchat.com
MIT License
467 stars 50 forks source link

"!>" (not greater than) generates exception not caught by UdonSharp #5

Closed DarkSpacer1 closed 2 years ago

DarkSpacer1 commented 2 years ago

This line of code: if (otherNeso.isPanicing && Vector3.Distance(transform.position, otherNeso.transform.position) < 0.4 && interactionType != 3 && interactionStep !> 0)

THe last comparison in this if statement generates an exception: Apparently !> is not a symbol recognized by UdonSharp. This generates an unhelpfull error: Error: Could not load signature of VRC.SDK3.Components.MultipleDisplayUtilities:GetRelativeMousePositionForDrag due to: Could not load file or assembly 'UnityEngine.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. assembly:UnityEngine.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null type: member:(null) signature:

It seems that this symbol is not a standard operator, but the errors generated by its use are very unhelpful. It could be good to insert at least some sort of error message...I spent a few days trying to figure out what the heck was going on >_<

MerlinVR commented 2 years ago

This is a Unity error when loading assemblies and has no bearing on U# as far as I am aware.

DarkSpacer1 commented 2 years ago

What I was trying to say was the error fell through UdonSharp entirely and landed on UnityEngine.UI. When I removed the offending symbol the error I gave went away.

MerlinVR commented 2 years ago

That is a syntax error and shows up fine for me in compiles as expected, make sure you aren't hiding errors in the console. image image

edit: Also to add, errors past syntax errors are not in the scope for 0.x to throw errors on since it relies on Unity to fail to compile the C# scripts through its normal pipeline for higher level semantic or flow control errors in many cases. 1.0 does a full compile of the code and will throw an error as part of the U# compile for any invalid C# code as well to provide more errors to users.

DarkSpacer1 commented 2 years ago

That's interesting. Visual Studio Code doesn't seem to mark it as bad syntax...

MerlinVR commented 2 years ago

Generally VS code's C# support for Unity is pretty lacking. I'd suggest Visual Studio, or if you can pay for it, Rider is absolutely worth it.

DarkSpacer1 commented 2 years ago

I've never really run into anything like this error with VSCode before and I'm been doing some advanced things with U#. In this case I can just use "==" instead anyway