Sometimes, after an upgrade, the add-ins won't recompile, claiming various errors in system and custom add-ins. This topic describes known problems.
A general remedy is to attempt to rebuild the entire solution. Close all GN4 applications and then on the Build menu, click Rebuild solution. If the compile errors persist also after you rebuilt the solution, the next check to do is to verify that the installed system and custom add-ins correspond to the installed GN4 version. |
Sometimes, during an upgrade, the file replacement may silently fail because some files remain in use although you don't have any GN4 application running - but perhaps Back4 is running on the same machine, or an application just hung and remained active in the Task Manager. Moreover, sometimes, the add-ins may fail to overwrite the existing ones (because in use, or read-only). So, make sure that add-ins correspond to BIN folder, and in the worst case, repeat the download and extraction of files from ZIP. Moreover, make sure that you respected the standard path structure (the BIN and the SRC folder are on the same level, and the addins are in the GN4ADDINS subfolder of SRC. Finally, right-click each VB project in the GN4 add-ins solution, select Properties, and then on the References tab check that the paths to references are all complete and pointing to the expected and the appropriate folder. If the errors refer only to the custom add-ins, it may be that the general structure of your custom add-ins is out of date. |
Check that the Target Framework version on the Application tab corresponds to the same value in all custom add-ins corresponds to the one in the system add-ins. Update the value if needed to the requested one. |
The newer functionalities may require additional or different Imports. The best approach is to merge the standard custom add-ins with yours, with the following procedure: 1.Make a copy of all your code in all your custom add-ins, one-by-one: this applies only on parts between markers '---------------- start of "your custom code" zone and '---------------- end of "your custom code" zone, therefore excluding Import and Inherits, starts and ends of Classes etc. 2.Replace, one-by-one, all the code in the custom add-ins with the code of standard custom add-ins. 3.Paste back the code you've copied in the step #1, again one-by-one, between the markers '---------------- start of "your custom code" zone and '---------------- end of "your custom code" zone. 4.Recompile. If the custom add-ins still give errors, it is likely they contain the code calling outdated or changed system functions. System functions can change the type and the number of parameters, so the new ones cannot be called any more in the old way. |
Locate the error point, and then look at the call structure. Identify the function name, and then search for the such name in all add-ins. Check the syntax on the points where the calls appear in the system add-ins. An example This code in a custom add-in v1.3 was causing error when run in 2.0: Dim login As Common.ILogin = Editorial.EditorialLogin.GetLogin() Dim obj As GenericObj = New GenericObj(GN4.Schema.Class.txtObj.ObjectType(login.Schema)) obj.AddAttributeValue("notes", strDesc, True) login.UpdateObjs(New Integer() {objectid}, obj, Nothing, False, False, True, False, Nothing) The error was InvalidCastException: The reason for the error was that while in v1.3 the UpdateObjs system function required one generic object 'obj', in 2.0 it requires a list of objects. The solution was the following one: Dim login As Common.ILogin = Editorial.EditorialLogin.GetLogin() Dim obj As GenericObj = New GenericObj(GN4.Schema.Class.txtObj.ObjectType(login.Schema)) obj.AddAttributeValue("notes", strDesc, True) Dim ids As New List(Of Integer) From {objectid} login.UpdateObjs(ids, {obj}, Nothing, False, False, True, False, Nothing) Note: Have in mind that at the compile time, the compiler will report such errors in your custom add-ins only if you turned the Strict option on (it is Off by default). See Add-ins and Option Strict for further information. If the Strict option is not turned on, you may believe that everything is ok because all add-ins compiled, but then you may run into errors when the users start to work with the software. |