You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Up to recently everything was okay until something happened with Actions in C#.
I've met trouble invoking action with primitive types, while I never encountered this issue before (I was using it succesfully before).
Invoke action with primitive type (maybe any structure) - Object reference not set to an instance of an object.
Invoke action with string (and custom classes) - OK.
Dynamic invoke with primitive type - OK.
Foreach invoke action.GetInvocationList() - OK.
Error happens only with .Invoke() method with primitive(structure) types.
With client config disableRestrictedSandbox = true error was gone and .Invoke() works perfectly.
Reproduction steps
usingAltV.Net.Client;usingAltV.Net.Client.Elements.Data;namespaceTestProject.Client;publicclassTestResource:Resource{privatedelegatevoidTestDelegate(intvalue);privateAction<int>?_test1;privateAction<ConsoleColor>?_test2;privateAction<string>?_test3;privateTestDelegate?_test4;publicoverridevoidOnStart(){Alt.Logger.LogInfo("Started TestResource");_test1+= value =>Alt.Logger.LogInfo($"Test1: {value}");_test2+= value =>Alt.Logger.LogInfo($"Test2: {value}");_test3+= value =>Alt.Logger.LogInfo($"Test3: {value}");_test4+= value =>Alt.Logger.LogInfo($"Test4: {value}");Alt.OnKeyDown+=AltOnOnKeyDown;}privatevoidAltOnOnKeyDown(Keykey){if(key!=Key.J){return;}try{_test1?.Invoke(5);}catch(Exceptione){Alt.Logger.LogError($"_test1: {e}");}try{_test2?.Invoke(ConsoleColor.Green);}catch(Exceptione){Alt.Logger.LogError($"_test2: {e}");}try{_test3?.Invoke("Invoke");}catch(Exceptione){Alt.Logger.LogError($"_test3: {e}");}_test4?.Invoke(11111);_test1?.DynamicInvoke(123);_test2?.DynamicInvoke(ConsoleColor.Red);_test3?.DynamicInvoke("Dynamic invoke");}publicoverridevoidOnStop(){Alt.Logger.LogInfo("Stopped TestResource");}}
Expected behaviour
.Invoke() method works as well
Additional context
No response
Operating system
Windows 11
Version
16.2.26
Crashdump ID
No response
Confirmation of issue's presence
By submitting this ticket, I affirm that I have verified the presence of this issue on the latest RC (Release Candidate) version available at the time of writing this ticket.
The text was updated successfully, but these errors were encountered:
Description of the problem
Up to recently everything was okay until something happened with Actions in C#.
I've met trouble invoking action with primitive types, while I never encountered this issue before (I was using it succesfully before).
Invoke action with primitive type (maybe any structure) - Object reference not set to an instance of an object.
Invoke action with string (and custom classes) - OK.
Dynamic invoke with primitive type - OK.
Foreach invoke action.GetInvocationList() - OK.
Error happens only with .Invoke() method with primitive(structure) types.
With client config disableRestrictedSandbox = true error was gone and .Invoke() works perfectly.
Reproduction steps
Expected behaviour
.Invoke() method works as well
Additional context
No response
Operating system
Windows 11
Version
16.2.26
Crashdump ID
No response
Confirmation of issue's presence
The text was updated successfully, but these errors were encountered: