Bug When using List<> type
Hi Keen team,
Congrats on the 1.206 update - the trailer was awesome and I love the direction the game is moving!
I've been developing the Mother OS script for some time now and sadly, it looks like the latest update has broken something within the PB interface. I am now getting errors when compiling that did not exist before.
To the best of my knowledge, the issue seems to reside in how types are being checked. I use MDK2 to build scripts, and ensure to follow the best practices closely. The issue appears isolated to interacting with Interfaces across the code base (all classes, interfaces, etc. are wrapped in a partial Program class). When compiling in game I am getting an error telling me of a type mismatch, though the codebase has not changed and everything appears to exist within the same namespace when inspecting the built script in IngameScripts/Project/script.cs.
Error [Program.Class] does not implement interface member [Program.Interface.Method]. [Program.Interface.Method] cannot implement [Program.Interface.Method] because it does not have the matching return type [List<Program.Interface>]
From discussion on Discord, we were able to determine this is a compile error when using a List. I have since replaced with MemorySafeList and things are working. I suspect there is a bug here.
ORIGINAL IMPLEMENTATION
namespace IngameScript { partial class Program { /// <summary> /// The abstract class that all core modules can inherit from. /// This exposes common functionality and ensures /// compatibility with IModule. /// </summary> public abstract class BaseCoreModule : ICoreModule { /// <summary> /// The list of commands for this module. /// </summary> public List<IModuleCommand> Commands = new List<IModuleCommand>(); } /// <summary> /// This scopes a "core" module. /// </summary> public interface ICoreModule : IModule { } /// <summary> /// Generic module definition in our system. /// </summary> public interface IModule { /// <summary> /// Get the commands for a module. /// </summary> /// <returns></returns> List<IModuleCommand> GetCommands(); } } }NEW IMPLEMENTATION
partial class Program { /// <summary> /// The abstract class that all core modules can inherit from. /// This exposes common functionality and ensures /// compatibility with IModule. /// </summary> public abstract class BaseCoreModule : ICoreModule { /// <summary> /// The list of commands for this module. /// </summary> public MemorySafeList<IModuleCommand> Commands = new MemorySafeList<IModuleCommand>(); } /// <summary> /// This scopes a "core" module. /// </summary> public interface ICoreModule : IModule { } /// <summary> /// Generic module definition in our system. /// </summary> public interface IModule { /// <summary> /// Get the commands for a module. /// </summary> /// <returns></returns> MemorySafeList<IModuleCommand> GetCommands(); } }
I've resolved with a simple find-and-replace List<> => MemorySafeList<> but of course this is a bit janky for my taste.
Thanks for time and ongoing support!
Luke
Hello Engineer,
thank you for reaching our forum with this problem.
The issue has been reported into our internal system.
Kind Regards
Keen Software House: QA Department
Hello Engineer,
thank you for reaching our forum with this problem.
The issue has been reported into our internal system.
Kind Regards
Keen Software House: QA Department
Replies have been locked on this page!