'Unable to call hook directly' warning message -- Seems to still workBug

I have a plugin that references a custom extension I made. So far it works fine, but whenever someone types in a chat command or when any hook is called, I get this warning message in the console. (Spams the console most times).

The custom extension I wrote runs outside of the sandbox and does things that plugins can't normally. At the same time, my plugin inherits from RustPlugin as this is how I'm responding to chat commands and rust hooks, so is there a way I can keep this functionality and not have this message be spammed in the console? Is there a way not to have oxide freak out or at least suppress this particular warning message? Any insight would be appreciated.

-Atlas

Your extension should be inheriting CSPlugin, not RustPlugin for its internal plugin.
In response to Wulf ():
Your extension should be inheriting CSPlugin, not RustPlugin for its internal plugin.
When I tried this the plugin wasn't able to call things like PrintToChat or respond to chat commands. How would I access the rust plugin functionality from CSPlugin in this case?

Also how would other plugins besides the internal plugin be able to call functions provided by the extension without needing to be directly loaded by my extension?
In response to AtlasAttack ():
When I tried this the plugin wasn't able to call things like PrintToChat or respond to chat commands...
Those are only available in specific plugin types, you'd have to create your own in extensions generally else call game-specific methods. Extensions aren't really meant to be plugins, so things like RustPlugin are only for actual plugins.

To call methods in your extension, you'd have to add a reference to your extension in the plugin using "// Reference: Oxide.Ext.YourExtension" at the top, and then use it like you would any other C# call. You can also call parts of your extension's plugin like you would any other plugin.
When I first made the Rustplugin in question it referenced my extension dll with the // Reference: Oxide.Ext.ExtensionName syntax, however in the console I was getting an error message saying that the plugin wasn't loaded, even though it recognized the reference.

What I assumed this meant was that all Plugins that referenced custom extensions had to be loaded directly from the extension itself, using pluginloader. But doing it this way meant the plugin itself wouldn't be a separate C# file like most other plugins (Including it in the plugins folder as such caused a duplicate plugin error).
Simply adding the reference wouldn't add a reference to your extension's internal plugin, it'd only allow you to access normal methods in that plugin directly. 
In response to Wulf ():
Those are only available in specific plugin types, you'd have to create your own in extensions gener...
When I'm back at my computer in a bit I'll be able to give more specific examples of the errors I was getting using //Reference: Oxide.Ext.YourExtension stuff.
In response to Wulf ():
Simply adding the reference wouldn't add a reference to your extension's internal plugin, it'd only...

So when I add the //Reference to my extension I get:

"Extension is referenced by RustAlerts plugin but is not loaded! an appropriate include file needs to be saved to plugins/include/extensionname if this extension is not required"

 

How would I address this?

I’d need to know exactly what you added, not an abridged version of it.
My RustPlugin:
// Reference Oxide.Ext.RustAlertsExtension

using Oxide.Core;
using Oxide.Core.Plugins;
//using Oxide.Ext.RustAlertsExtension; Commented this out to make visual studio happy
using Oxide.Ext.RustAlertsExtension.Libraries;
using Rust;
using System;
using UnityEngine;
using static Oxide.Ext.RustAlertsExtension.Libraries.RustAlert;


namespace Oxide.Plugins
{
	[Info( "RustAlerts", "Atlas Incawporated", 1.1 )]
	[Description( "Send server-wide alerts via global chat." )]
	public class RustAlerts : RustPlugin
	{

//Class implementation
}


**My CS plugin
// Reference: System.Runtime
// Reference Oxide.Ext.RustAlertsExtension

using Oxide.Core.Plugins;
using Oxide.Core;
using UnityEngine;
using Oxide.Ext.RustAlertsExtension;
using RustAlertsPlugin.Logging;
using Oxide.Ext.RustAlertsExtension.Libraries;


namespace Oxide.Plugins
{

public class RustAlertsPlugin : CSPlugin
{


My Extension:

// Reference: System.Runtime
// Reference Oxide.Ext.RustAlertsExtension

using Oxide.Core;
using Oxide.Core.Extensions;
using UnityEngine;
using Oxide.Unity.Plugins;

namespace Oxide.Ext.RustAlertsExtension
{
	public class RustAlertsExtension : Extension
	{

         }

}


Anything else or something specific you'd need to see?  

The full error message I get (when starting the server) is "RustAlertsExtension is referenced by RustAlerts plugin but is not loaded! An appropriate include file needs to be saved to plugins/include/Ext.RustAlertsExtension.cs if this extension is not required."

Edit: Earlier versions of the code I posted had a typo for the // Reference part when I posted. Still giving me the same error though.

In response to Wulf ():
I’d need to know exactly what you added, not an abridged version of it.
From the error message is it indicating that the RustPlugin won't load because it references the extension? Or is it implying the rust plugin can't reference the extension because the extension isn't loaded? 
I would need to see the exact usage you have.
In response to Wulf ():
I would need to see the exact usage you have.

Usage of what? What do you need to see I will provide it. Also I tried making a brand new test RustPlugin that references my DLL, I get the same error message when loading even that plugin. However the extension itself is loading which makes the error message even more ominous.

OnServerInitialized is called on both my internal plugin and in the logs its obvious the extension itself loads. However the second a plugin tries to reference the extension the plugin will NOT load.

Check out the test plugin I wrote :

// Reference Oxide.Ext.RustAlertsExtension
using Oxide.Ext.RustAlertsExtension.Libraries;
using Oxide.Plugins;
using System;
using System.Collections.Generic;
using System.Text;
using UnityEngine;

namespace Oxide.Plugins
{
	[Info("TestPlugin", "Atlas Incawporated",0.1)]
    public class TestPlugin : RustPlugin
    {
		[ChatCommand("test")]
		void TestFunction(BasePlayer player) {
			PrintToChat( "Test complete!", "" );
		}

		void Loaded() {
			Debug.Log( "Test Plugin loaded -(Onloaded) called!" );
			Reporter.ReportServerTime( DateTimeOffset.Now.ToUnixTimeSeconds() );
			Debug.Log( "Test Plugin finished execution! -(Onloaded) called!" );
		}

    }
}

No references to anything else, yet in the console upon loading I get:"Oxide.Ext.RustAlertsExtension 
is referenced by TestPlugin but is not loaded! An appropriate include file needs to be saved to plugins/include/..(extension name) if this extension is not required."

This TestPlugin is referenced nowhere else, can you at least clarify what this error message is supposed to mean? Why does the plugin refuse to load if and only if it references an extension which is already loaded?



Merged post

Also can you point me to any examples of a RustPlugin referencing an external dll extension and not failing to load? Like I said, all of these problems went away when I loaded the plugin manually through pluginloader in the extension, but that gives me the error message I started with.
In response to Wulf ():
Those are only available in specific plugin types, you'd have to create your own in extensions gener...
My test plugin does exactly this, has the // Reference at the top, and in the Loaded() function it accesses a method from the extension. But the plugin will not load as described in the error above.

The TestPlugin is not used anywhere else.
In response to AtlasAttack ():
My test plugin does exactly this, has the // Reference at the top, and in the Loaded() function it a...
Okay, but what is the exact usage?