I have composed a list of errors that might occur while writing Manifold scripts/add-ins/apps. There is also a .cs file in the attachment.
Developing scripts/add-ins/apps with cutting edge Manifold 9 builds is very easy - no separate SDK to install, one source file is often enough, etc.
But it can sometimes also be tricky, if there is an error message and you do not know what caused it.
Problems with add-in .dll or .cs file.
1. Addin is not visible in Tools -> Add-ins -> ...
* Missing *.dll.addin file
* Add empty MyAddin.dll.addin http://www.manifold.net/doc/mfd9/tools_-_add-ins.htm
* The dll does not have class Script
* rename the main class to Script
* Class Script is not public
* add public to class Script
* Class Script is not in default namespace
* remove explicit namespace
* Script does not have method Main
* rename method to Main
* Main method is not static
* add static to Main
* Main method is not public
* add public to Main
2. Can't run script, no entry point (Script.Main).
* Script.Main cannot take arguments
* remove any arguments
3. Object reference not set to an instance of an object.
* Class Script has field of type Manifold.Context but not named Manifold
* rename the field to Manifold
4. An object reference is required for the non-static field, method, or property 'Script.Manifold'
* Script.Manifold is not static field
* add static to the field Script.Manifold
Problems with standalone applications without Manifold GUI. http://www.georeference.org/forum/t144119#144289
1. Error CS0246 The type or namespace name 'Manifold' could not be found (are you missing a using directive or an assembly reference?)
* Missing or outdated reference
* Add reference to current EXTNET.DLL
2. Runtime 'System.BadImageFormatException' occurs
* Build target is 'x86' or 'AnyCPU' with 'Prefer 32bit' checked.
* Uncheck 'Prefer 32bit' or change target to 'x64'
3. Runtime 'Invalid API operation' occurs
* Manifold.Root does not have correct path to EXT.DLL
* Call Manifold.Root("ext.dll") with correct path to EXT.DLL (not EXTNET.DLL)
* Missing [STAThread] attribute
* Add [STAThread] attribute to Main
4. Object reference not set to an instance of an object.
* CreateDatabaseForFile returns null
* Manifold not activated, activate
Problems calling functions defined in external script (dll or cs) from Manifold SQL
1. Invalid entry point.
* The name in ENTRY declaration must be 'ClassName.MethodName' or 'Namespace.ClassName.MethodName'
2. Can't run script, no entry point type.
* Namespace name or class name is wrong in ENTRY declaration
3. Can't run script, no entry point (ClassName.WrongMethodName).
* Method name in ENTRY declaration is wrong
4. Can't run script, no entry point (Script.NonStaticExample).
* SQL9 cannot call non-static methods
* make method static
5. Can't run script, wrong number of parameters
* wrong number of parameters
6. Can't run script, type mismatch
* type mismatch
7. Object reference not set to an instance of an object.
* calling app.GetDatabaseRoot() with no project open
* check (db != null)