05, September 2024 UPDATE

If you are recieving the following message when trying to "load" (o.load / o.reload AutoDoors) in the console, after noticing it isn't functioning on your server any longer.Β 

Error while compiling AutoDoors: The type 'System.Text.StringBuilder' cannot be used as type parameter 'T' in the generic type or method 'Pool.Free<T>(ref T)'. There is no implicit reference conversion from 'System.Text.StringBuilder' to 'Facepunch.Pool.IPooled'.

HotFix until the Developer updates this part of the code:
Locate the .cs file under oxide\plugins\AutoDoors.cs
Change line
(433) "Pool.Free(ref stringBuilder);" to "Pool.FreeUnmanaged(ref stringBuilder);"

Notes:
Look into the patch notes for the September 5th 2024 Rust Update. A new Developer in the performance division has stated that a new code process is being installed and a few things will no longer work when it comes to "Pool.Free". This pertains to many mods / plugins including this one...

Hope this Helps!



An this to ^^

Search:
Pool.Free
Replace it with:
Pool.FreeUnmanaged

Worked great thanks!

Yep, that works great thank you. πŸ™‚

Love the help. TY.

AlexTop

Search:
Pool.Free
Replace it with:
Pool.FreeUnmanaged

Might not always work. Be careful with this becuase there are different one's that might work if they stay just Pool.FreeΒ 

The best practice I found is to change one, save it. Reload the file. Reload the plugin and watch the console. Because if the initial error doesn't change where the "position of the error" example: Error, Line ##, Pos ##. Then that means the line hasn't worked by changing it.Β 

Came here to say it worked for me also Ty <3

Working Great

AlexTop

Search:
Pool.Free
Replace it with:
Pool.FreeUnmanaged

In this case, the use of Pool.FreeUnmanaged might not be necessary, since StringBuilder is a managed object in .NET and doesn't require manual memory management typically associated with unmanaged resources.

Replacing Pool.Free with StringBuilder.Clear() seemed like a more appropriate solution to clear the contents of the StringBuilder without risking memory issues. The Pool.FreeUnmanaged method would be more suitable for unmanaged resources that require explicit memory release.

If there's any additional reason or context behind the suggestion to use Pool.FreeUnmanaged, I'd be happy to hear your thoughts.

w482fmy8YNetpyM.png scalbox

Hi
I have created a fork of the plugin to keep it updated and add new features.

I hope it is useful

https://digitalmarketplay.com/product/auto-doors/

Thankyou so very much for your efforts. I dont know much about code, but it looks much more compact and streamlined now than before, when looking at the code :)

Thank you for the fix/tip!!

Pooling StringBuilder for help command seems unnecessary to say the least. And using Pool.FreeUnmanaged(ref ...) seems wrong at first look (generic allocation, but untyped deallocation does not compute). The proposed change compiles, but may not clean up memory. I suggest just skipping pooling...

Replace "Pool.Get<StringBuiler>()" with new "StringBuiler()" and remove "Pool.Free(stringbuilder)". The GC will clean it up when it goes out of scope, which is at the "}".

New code (including changes as comments):


                    case "help":
                    {
                        // StringBuilder stringBuilder = Pool.Get<StringBuilder>(); <-- Replace this
                        StringBuilder stringBuilder = new StringBuilder();       // <-- With this
                        stringBuilder.AppendLine();
                        var firstCmd = configData.chatS.commands[0];
                        stringBuilder.AppendLine(Lang("AutoDoorSyntax", player.UserIDString, firstCmd));
                        stringBuilder.AppendLine(Lang("AutoDoorSyntax1", player.UserIDString, firstCmd, configData.globalS.minimumDelay, configData.globalS.maximumDelay));
                        stringBuilder.AppendLine(Lang("AutoDoorSyntax2", player.UserIDString, firstCmd));
                        stringBuilder.AppendLine(Lang("AutoDoorSyntax3", player.UserIDString, firstCmd, configData.globalS.minimumDelay, configData.globalS.maximumDelay));
                        stringBuilder.AppendLine(Lang("AutoDoorSyntax4", player.UserIDString, firstCmd));
                        stringBuilder.AppendLine(Lang("AutoDoorSyntax5", player.UserIDString, firstCmd, configData.globalS.minimumDelay, configData.globalS.maximumDelay));
                        stringBuilder.AppendLine(Lang("AutoDoorSyntax6", player.UserIDString, firstCmd, configData.globalS.minimumDelay, configData.globalS.maximumDelay));
                        Print(player, stringBuilder.ToString());
                        // stringBuilder.Clear(); <-- Not necessary
                        // Pool.Free(ref stringBuilder); <-- Removed
                        return;
                    }