1. Kovalev PWnz

    Kovalev PWnz Scavenger

    Code (Text):
    03:46 [Error] Failed to call hook 'Unload' on plugin 'MySqlConnector v4.2017.301' (NullReferenceException: Object reference not set to an instance of an object)
    03:46 [Stacktrace]   at MySql.Data.MySqlClient.MySqlDataReader.Close () [0x00000] in <filename unknown>:0
      at MySql.Data.MySqlClient.MySqlConnection.Close () [0x00000] in <filename unknown>:0
      at Oxide.Core.MySql.Libraries.MySql.CloseDb (Oxide.Core.Database.Connection db) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.MySqlDatabase.Close () [0x00000] in <filename unknown>:0
      at Oxide.Plugins.MySqlConnector.Unload () [0x00000] in <filename unknown>:0
      at Oxide.Plugins.MySqlConnector.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.CSharpPlugin.InvokeMethod (HookMethod method, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00000] in <filename unknown>:0
    It seems that this error occurs if there is an unfinished transaction. Maybe, need to update MySql.Data.dll lib
     
  2. Resistance

    Resistance Grenade Master

    You need to talk to the coder who made you the custom plugin
     
  3. Kovalev PWnz

    Kovalev PWnz Scavenger

    Talk to yourself?
     
  4. Kappasaurus

    Kappasaurus Shotgun Ace Plugin Developer

    Don't think that's a custom plugin. MySQL Extension | Oxide
     
  5. Resistance

    Resistance Grenade Master

    I done a search came up with nothing its why I thought it was a custom one well in that case then it needs posted in the plugin topic for support
     
  6. Kappasaurus

    Kappasaurus Shotgun Ace Plugin Developer

    There is actually not a support thread, it's part of Oxide. This is where it belongs.
    --- Double Post Merged, Apr 16, 2017 ---
    Well, or in the Rust Discussion.
     
  7. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    MySqlConnector is the name of the plugin the OP is using, which is not from Oxide. Without seeing code, it's hard to know exactly what the OP is doing with the plugin for it to throw this error.
     
    Kappasaurus likes this.
  8. Kovalev PWnz

    Kovalev PWnz Scavenger

    Code (Text):
    using System;
    using System.Collections.Generic;
    using Oxide.Core.MySql.Libraries;
    using Oxide.Core.Database;

    namespace Oxide.Plugins {
        [Info("MySqlTest", "MySqlTest", "1.0.0")]
        public class MySqlTest : RustPlugin {
            Oxide.Core.MySql.Libraries.MySql mySql;
            Connection connection;

            void Init() {
                mySql = new Oxide.Core.MySql.Libraries.MySql();
                connection = mySql.OpenDb("localhost", 3306, "oxide", "oxide", "oxide", this, true);

                mySql.Query(new Sql("SELECT * FROM players LIMIT 10"), connection, (List<Dictionary<string, object>> rows) => {
                    foreach (var row in rows) {
                        Puts(Convert.ToString(row["steamID"]));
                    }
                });
            }

            void Unload() {
                // eg last transaction
                mySql.Query(new Sql("SELECT * FROM players LIMIT 10"), connection, (List<Dictionary<string, object>> rows) => {
                    foreach (var row in rows) {
                        Puts(Convert.ToString(row["steamID"]));
                    }
                });

                mySql.CloseDb(connection);
            }
        }
    }
     
    Code (Text):
    18:01 [Info] Unloaded plugin MySqlTest v1.0.0 by MySqlTest
    6:01 PM [Error] MySql handle raised an exception (NullReferenceException: Object reference not set to an instance of an object)
    6:01 PM [Stacktrace]   at MySql.Data.MySqlClient.MySqlConnection.get_ServerThread () [0x00000] in <filename unknown>:0
      at MySql.Data.MySqlClient.MySqlConnection.Abort () [0x00000] in <filename unknown>:0
      at (wrapper remoting-invoke-with-check) MySql.Data.MySqlClient.MySqlConnection:Abort ()
      at MySql.Data.MySqlClient.MySqlDataReader.NextResult () [0x00000] in <filename unknown>:0
      at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader (CommandBehavior behavior) [0x00000] in <filename unknown>:0
      at MySql.Data.MySqlClient.MySqlCommand.AsyncExecuteWrapper (Int32 type, CommandBehavior behavior) [0x00000] in <filename unknown>:0
    18:01 [Error] MySql command callback raised an exception (NullReferenceException: Object reference not set to an instance of an object)
    18:01 [Stacktrace]   at Oxide.Plugins.MySqlTest.<Unload>m__1 (System.Collections.Generic.List`1 rows) [0x00000] in <filename unknown>:0
      at Oxide.Core.MySql.Libraries.MySql+MySqlQuery+<>c__DisplayClass24_0.<Handle>b__0 () [0x00000] in <filename unknown>:0