Use Components can give free minerals.
If you use components when building multiple ships at a time, you can get free minerals.
Steps:
1) Make a new ship class, add a single engine, and then build a few of those engines with factories.
2) Create a new shipyard, tool it for the new class, and add a second slipway.
3) Delete all other shipbuilding tasks at this colony (not required, but makes it easier to see the effect of the bug).
4) Back on The Shipyards tab, select the new yard, tick the Use Components checkbox (make sure you have the correct engine in the stockpile at this colony), and click the Create Task button twice.
5) On the Mining tab, middle pane, observe the negative value for Gallicite in the SY Tasks column. (It is probably equal to twice the gallicite cost of the new ship class.)
6) Advance time, and observe that your Gallicite stockpile is in fact benefiting from this "income" (i.e., it is not merely a display glitch).
Note that if you do more ships at once, the negative gallicite gained per ship increases. It seems to be equal to N * (N-1) * cost per ship.
Also note: you can prevent the bug by selecting a different shipyard after you click the Create Task button. If you then re-select the original yard and click the Create Task button again, the bug does not occur.
Well spotted!
Aurora uses a class called Materials to hold amounts of all eleven minerals, along with a variety of functions to manipulate them. When you are setting up a shipyard task, an instance of this class called CurrentMaterials is used to hold the mineral requirements for the current selection, which allows display of those amounts, etc.. When a shipyard task is created, the information from CurrentMaterials is passed to the TaskMaterials object associated with the shipyard task.
However, I was passing CurrentMaterials by reference and not by value (the Materials class has a specific CopyMaterials function that passes by value but I forgot on this occasion). This issue doesn't matter if you build several ships in the same shipyard without using components because they are all the same materials anyway. However, if you use components then the same Materials instance is being reduced once for every new TaskMaterials object that references the original CurrentMaterials object.
Once you change task type or shipyard, the CopyMaterials is set to null or a new instance and then repopulated, so the problem goes away. In C#, as you probably know, when you pass an object by reference to a second object, you are not passing the address of the first object, but actually passing a reference to the address of the data used by the first object. If that data changes, it changes for both objects using that data reference. However, if you reset the first object (either using new or null), it now references a new data location. The second object retains knowledge of the first objects original data, even though the first object is now using new data. That is why changing shipyards in-between tasks avoids the bug.
An intriguing demonstration of C# referencing rules