Skip to content
RustPluginGenerator
CS1955Oxide + Carbon

Fix CS1955: Non-invocable member 'Item.amount' cannot be used like a method (Oxide)

CS1955 means you wrote a field or property followed by parentheses, as if it were a method. `Item.amount` is an int field, so calling `item.amount()` is invalid; write `item.amount` and the plugin compiles again.

Server console
Error while compiling StackCounter:
[1] Non-invocable member 'Item.amount' cannot be used like a method. at 45:35

Why it happens

In the Rust assemblies Item.amount is a plain int field that stores the stack size. Parentheses after a field are a method call in C#, and the compiler rejects the invocation with CS1955. The same mistake shows up with other members that look like verbs: item.condition, player.health, item.info, player.userID. The line/column in the Oxide line (at 23:29) points into the .cs file, not into the console, so open the plugin and look at that offset. Roslyn stops at the first offending member per line, so a plugin that treats one item field as a method usually hides the same bug on later lines behind the first error.

How to fix it

  1. Open the plugin source listed in the console line (Error while compiling StackCounter:).
  2. Go to the reported line and column and remove the () after a field such as amount, condition or health.
  3. If you meant to compute something (for example the total of several stacks), keep the field read and do the arithmetic yourself; there is no Amount() method on Item.
  4. Search the file for other () on item or player fields before saving.
  5. Save the file; Oxide reloads it automatically. A clean build prints Loaded plugin StackCounter v1.0.0 by ... and no Error while compiling block. You can force it with oxide.reload StackCounter.

Before and after

BeforeFails
using System.Collections.Generic;
using Oxide.Core;
using UnityEngine;

namespace Oxide.Plugins
{
    [Info("StackCounter", "RustPluginGenerator", "1.0.0")]
    [Description("Reports how many of an item a player is carrying via chat command.")]
    public class StackCounter : RustPlugin
    {
        private const string PermUse = "stackcounter.use";

        private void Init()
        {
            permission.RegisterPermission(PermUse, this);
        }

        [ChatCommand("stack")]
        private void CmdStack(BasePlayer player, string command, string[] args)
        {
            if (player == null || args == null || args.Length == 0)
            {
                return;
            }

            if (!permission.UserHasPermission(player.UserIDString, PermUse))
            {
                SendReply(player, "You do not have permission to use this command.");
                return;
            }

            string shortname = args[0].ToLower();
            ItemDefinition def = ItemManager.FindItemDefinition(shortname);
            if (def == null)
            {
                SendReply(player, "Unknown item: " + shortname);
                return;
            }

            int total = 0;
            foreach (Item item in player.inventory.containerMain.itemList)
            {
                if (item.info.itemid == def.itemid)
                {
                    total += item.amount();
                }
            }

            SendReply(player, def.displayName.english + ": " + total);
        }
    }
}
AfterFixed
using System.Collections.Generic;
using Oxide.Core;
using UnityEngine;

namespace Oxide.Plugins
{
    [Info("StackCounter", "RustPluginGenerator", "1.0.0")]
    [Description("Reports how many of an item a player is carrying via chat command.")]
    public class StackCounter : RustPlugin
    {
        private const string PermUse = "stackcounter.use";

        private void Init()
        {
            permission.RegisterPermission(PermUse, this);
        }

        [ChatCommand("stack")]
        private void CmdStack(BasePlayer player, string command, string[] args)
        {
            if (player == null || args == null || args.Length == 0)
            {
                return;
            }

            if (!permission.UserHasPermission(player.UserIDString, PermUse))
            {
                SendReply(player, "You do not have permission to use this command.");
                return;
            }

            string shortname = args[0].ToLower();
            ItemDefinition def = ItemManager.FindItemDefinition(shortname);
            if (def == null)
            {
                SendReply(player, "Unknown item: " + shortname);
                return;
            }

            int total = 0;
            foreach (Item item in player.inventory.containerMain.itemList)
            {
                if (item.info.itemid == def.itemid)
                {
                    total += item.amount;
                }
            }

            SendReply(player, def.displayName.english + ": " + total);
        }
    }
}

FAQ

Why does `item.amount()` sometimes seem to work?

It never compiles. If a plugin runs, it was built from a version without the parentheses. Check that the file you edit is the one Oxide loads: oxide/plugins/StackCounter.cs (or carbon/plugins).

Is there a method that returns the stack size?

No. Read the amount field directly. To change it, assign item.amount = value; and call item.MarkDirty() so clients see the new stack count.

What other members produce CS1955 in Rust plugins?

Any field used with parentheses: player.health(), entity.skinID(), item.condition(), player.userID() when you wanted player.userID.Get(), item.info() instead of item.info.

Does Carbon report this the same way?

Carbon loads the same C# plugins and compiles them too, so a CS1955 file fails there as well. The console format differs but the fix, removing the parentheses, is identical.

Different error?

Paste the full console output and get the cause and a fix in plain English.

Open the error explainer

Skip the debugging

Generated plugins are compiled before you get them, and compiler errors are fixed automatically.

Generate a plugin

2 free plugins a month, no card.

Last updated Oct 26, 2026.

Get plugins that compile first time

Generate