-
-
Notifications
You must be signed in to change notification settings - Fork 490
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Error / incorrect values when reading Nullable<T> properties #826
Comments
If thats a normal nullable, how are you getting an Il2CppInterop exception? |
The property in this case is an Il2CppSystem.Nullable:
|
I have a found a workaround, but I don't know if this is expected behaviour. In the case that the property is not null, unboxing to the type gives the correct value. Please let me know if there is a better way to do this.
|
All of the following criteria must be met
All of the following are optional to answer
Describe the issue.
Trying to read a property that is
Nullable<T>
will result in an exception if value is null, or an incorrect value if not null.I would expect to be able to read the property with a null conditional operator like so
MelonLogger.Msg(template.Duration?.value);
But this results in the exception in the logs below if the value is null.
To try to avoid this I can catch the exception
and this no longer throws, but the value returned is incorrect, in this case
-534465616
. CallingGetValueOrDefault
will return default in these cases.Full log below
Did you attach your log file?
Yes, I attached my log file to the text box above.
The text was updated successfully, but these errors were encountered: