Unofficial Content

Tips

How to include an external dll?

There are three cases:

1- Call a dll or .NET component


E.g.: there is a .NET assembly that adds one to a number, such as Sum.dll. To call it from GeneXus you must do the following:
A. Create a SUMGX.cs with the function definition. It must have an execute builder to call it; e.g.: the CS code would be:

Using classSum; // assembly Namespace
public void SUMGX(int YYYY ... );
public void execute(ref int YYYY )
{
/// call the assembly sum function

B. Include the reference to Sum.dll in the Compiler Flag preference
C. Copy Sum.dll to the model bin directory
D. Program the following from GeneXus code:

Call('SUMGX', &num)

Obtain an example at: http://www.gxopen.com/gxopen/servlet/projectinformation?395

2 - Call a dll COM

To call a dll Com from a .NET application, there is the "tlbimp" tool, which generates a dll .NET that operates as a bridge over the dll com.

E.g.:

tlbimp /out:GXNET.dll GXCOM.dll

The generated dll (GXNET.dll) is a dll .net based on the COM (GXCOM.dll)


This case is similar to the previous one, but in C you copy the dll created with tlbimp and the dll com.
Find an example at: http://www.gxopen.com/gxopen/servlet/projectinformation?8 version 1.4.2)


3- Call a dll No COM from .NET

Create a CS with the function definition. This case is similar to case 1, but using .NET Dllimport command it would be as follows:


DllImport("XXXXX.dll")

public static extern bool funcion(string YYYY ... );
public void execute(ref string YYYY )
{
/// call dll No COM functions

 

Note that it must also have the execute builder, which is the code translated by the generator in the source when doing a call.

Important: IN 80 version there is a change in calls internal generation:
In 7.5 version, on making a call to any procedure, the following is generated: new FUNCTION (ref _Context).execute(ref parm1 ...);

In 80 version, on making a call to any procedure, the following is generated: new FUNCTION(context ).execute( ref parm1 ... );

this implies that on migrating from one GeneXus version to the other, you must modify the builder (the builder parameters are no longer by reference).

Find an example at: http://www.gxopen.com/gxopen/servlet/projectinformation?395

How to generate PC code from il code?

There is the "ngen" tool, which compiles .NET platform intermediate code (IL code) in PC code. This could improve the execution performance,

ngen hgxtech.dll - this compiles the dll to PC code and installs it

ngen /show – shows the installed dlls

ngen hgxtech /delete – uninstalls it (operates with the Just in Time again)

1.Debuger can be debugged with dbgclr.exe located at: <ProgramFiles>\Microsoft.Net\Frameworksdk\guidebug or with the Visual Studio one, you can do it also from there.

Glossary

.Net remoting

It is a communications protocol for distributed objects. It may run on HTTP or TCP. If it runs on HTTP it can establish the communication in binary modality or using SOAP protocol.
For more information:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/introremoting.asp

.NET Channel Services

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/introremoting.asp

ADO.NET

ADO.NET is the native database access method in .NET platform. This group of libraries used to access data is contained within the .NET framework. They provide a significant improvement in the database access performance with the .Net generator. Besides, at technological level, 100% “.NET managed code is used.

ASP .NET Configuration Section

Assembly

It is the unit of the objects programmed with .Net

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconassembliesoverview.asp

Code Access Security

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/spptsdk/html/SPCodeAccessSec.asp

COM+

COM+ is a services infrastructure that supports components execution.

Among these services we can mention the following: automatic transactions, queued components, object pooling and other. Implementing COM+ components is possible in .NET.

Common Type System - CTS

CLR uses something called CTS for a strictly reinforced security type. This ensures that all the classes are compatible among them, describing types in a common way. CTS defines how the types operate in runtime (their declarations and their uses), which enables those types in a specific language to operate with types in other languages, including the management among different languages by exception.

In addition to guaranteeing that the types are suitably used, in runtime it is also ensured that the code does not attempt to access the memory that was not assigned to it (i.e.: it is a code with type security).

GeneXus .NET Generator

http://www.gxtechnical.com/net

Global Assembly Cache (GAC)

It is a reserved memory area used by .NET to store the assemblies of the applications running in a PC. An assembly must have a “Strong Name” to be stored in the GAC.

For more information:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconglobalassemblycache.asp

Log4net

http://logging.apache.org/log4net/

Managed Code

It is the code pointing at .NET that contains certain information extra metadata to describe itself. Although both the “managed code” and the one that is not can run in an execution PC, only the “managed code” contains the information that enables the execution PC to guarantee execution security and interoperability, among other things.

Managed Data

CLR provides memory assignment and unassignment features as well as deletion of superfluous information or trash. Some .NET languages use “managed data” by default (.NET, Visual Basic.NET, JScript.NET), while other (C++) don’t.

Depending on the language being used, the fact of pointing at CLR may establish certain constraints as regards features availability. E.g.: C++ loses the multiple inheritance. In addition to the possibility of having “managed code” and the one that is not, it is also possible to have “managed data” or not in .NET applications (data whose trash is not deleted but are nevertheless controlled by the “managed code”).

ODBC

ODBC(Open Database Connectivity) is a Database access standard developed by Microsoft. Its functionality is enabling to establish the connection of the application with the database with no need to know the DBMS where data are stored. ODBC is the intermediate tier between the application and the DBMS. The purpose of this tier is translating application data queries into commands that the DBMS can understand.

The .NET generator allows accessing with this method, but it is only recommendable for those database managers that do not provide an Ado.Net provider.

Session state

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconsessionstate.asp

Strong Name

A "Strong Name" determines the identity of an assembly, made up by its name and version plus a public key and digital signature. The .NET framework offers the possibility of assigning a “Strong Name" to an assembly.

For further information refer to:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconstrong-namedassemblies.asp

WMI (Windows Management Instrumentation)

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/wmi_start_page.asp

FAQ: Common Errors

Problems in executionh4>

WEB Models

o Server Error in '/services' Application:

System.BadImageFormatException: The format of the file 'HXXXX' is invalid.

File name: "reorganization"

Reasons/Solutions:

o Compilation is being performed with framework 2.0 and execution with framework 1.1 or lower version.

o Generation is being performed with GeneXus 8.0 version or lower one, and execution with framework 2.0.

o Server Error in '/services' Application.

Access to the path "C:\DOCUME~1\PC\ASPNET\LOCALS~1\Temp\e8ebd99f-17de-4447-83f8-35769f67bd23\iTextdotNET, Version=1.4.1964.2760, Culture=neutral, PublicKeyToken=bd3736a929f259c3" is denied.


Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.UnauthorizedAccessException: Access to the path "C:\DOCUME~1\PC\ASPNET\LOCALS~1\Temp\e8ebd99f-17de-4447-83f8-35769f67bd23\iTextdotNET, Version=1.4.1964.2760, Culture=neutral, PublicKeyToken=bd3736a929f259c3" is denied.

Reasons/Solutions:

- On execution, a PDF report is given and rights are constrained.

The solution is giving write rights in C:\Documents and Settings\

< webserver name >\<ASPNET\Local Settings\Temp

o Server Error in '/services' Application.

Access is denied.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.UnauthorizedAccessException: Access is denied.

Reasons/Solutions:

- When working in web environment with .Net and being with NTFS, it must also have Read & Execute rights, by default with ASPNET user; otherwise, an error occurs on displaying the page.

- It also occurs if an object uses any type of mail (Outlook), excel or word data; this involves the user of gxoffice2.dll, which is not registered in the web server. It may also occur because the dll is corrupted or is being used by another object.

o Configuration Error

Could not load file or assembly …

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Could not load file or assembly 'gxclasses' or one of its dependencies. The system cannot find the file specified.
 

Reasons/Solutions:

- The case occurred in a w2003, the virtual directory, with a green icon, was wrongly created. The Application name was default application. It was solved on pressing the create button.

- This may also occur if there aren’t Full Trust rights in security.

o Access is denied: 'GxOffice2Net'.


Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code
Exception Details: System.IO.FileLoadException: Access is denied: 'GxOffice2Net'

Reasons/Solutions: If you are working with <identity impersonate="true" /> and the user executing the page in IIS does not have write rights in C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\<name_virtual_directory>, this error occurs on executing a web panel that uses a smtpsession type variable; i.e.: attempts to send a mail via smtp.
The solution is giving the user write rights in this folder.

o GeneXus Fast Access Exception or message

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: GeneXus.DataAccess.GxFATDataException: GeneXus Fast Access Exception

Reasons/Solutions:

- Connecting to the database server is not possible

a. Verify the Dbms Option

b. Gxdata Dependencies

c. System datasource was not defined

d. Rights in thrusted connection in Sqlserver datasource

e. The user that runs the webpanels (host\ASPNET or IUSR_MASTER) does not have the required rights over the database.

- A problem of duplicated indexes or records in the database.

o The resource cannot be found.

Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
 

Reasons/Solutions:

The page is not found. Maybe it does not have the mapping to the dll in the web.config file of the bin directory or maybe it was not compiled.

Web config is generated by UpdateWebconfig from GXCFG.web file entries. In this case compile the object again and/or execute UpdateWebconfig

- Another reason maybe that IIS have not been started. Verifying if you can execute an HTML in the same URL is useful. In this case, start the web server.

- Another reason may be that there is a framework installation problem causing that the IIS does not recognize the .aspx. This occurs when installing the framework first and then the IIS, since the ASPNET user that runs the ASpnet_Wp service (which serves webpanels) does not have enough rights in the web server. In this case, execute the aspnet_regiis –i command (located under the framework installation directory).

- Another possibility: in Windows 2003 environment, where there are more security constraints, you must enable aspx files extension from:

Computer Management/ services And applications/Webservice Extensions/AspNet v1.14322 = allowed

You can also enable a specific extension editing the division properties in IIS and adding the extension Myme type in the HTTP Header section; for example, for txt:

Extension = .txt

Myme Type = application/octet-stream

 

o Object reference not set to an instance of an object

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an …
 

Reasons/Solutions: this is a general error, once it occurs with an object it may occur with any other one.

It may occur with Web transaction without confirm button or with any button that was not initialized (e.g.: a webcomponent).

Anther case may occur because of a database connection problem. E.g.: working with SQLServer handler, if the user access is setup by Windows (“Use Windows Authentication”) and the required rights are missing, the error occurs. This case is solved by adding the ASPNET user to the users group or changing the access to “SQL Authentication”.

If the error specifies the program line where it crashes, edit the CS in this line and verify the operation.

--------------------------------------------------------------------------------------------

o Specified cast is not valid.
Description: An unhandled exception occurred during the execution of the current web request...

Reasons/Solutions: Errors of types or values in parameters transfer. Verify them.

 

o Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: File or assembly name GXData, or one of its dependencies, was not found

Reasons/Solutions: A gxdata dependency is missing or the gxdata is not in the model bin. Delte *.ver of the model directory and regenerate the object.

 

o Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Method XXXX in Type GeneXus.Programs.XXXX form Assembly … does not have an implementation

Reasons/Solutions: The mentioned object (XXXX) was not generated or was generated with another version. Verify that this object specifies, generates and compiles and that the Standard classes are the corresponding ones (to force the classes copy you can delete the *.ver and generate an object).

This error may also occur if the object has at any time existed in the model and was deleted, but the dll is kept in the bin directory.

The error only occurs with the Config http Handler Section property with its default value (for each object); if it is modified to Handler Factory (or ashx) the error will not occur on starting the application but on attempting to access the object (XXXX).

 

o Application has generated an exception that could not be handled

Description: Application has generated an exception that could not be handled

Process id=0x67c (1660), Thread id=0x6c4(1732)"

Reasons/Solutions: To give rights execute "Control panel\Administrative Tools\Microsoft .NET Framework 1.1 Wizards\Adjust .Net security\Make changes to this computer\Local intranet", there, you must setup the Full trust value.

 

GUI Models

o System.IO.IOException: The process cannot access the file client.log" because it is being used by another process.

Esto ocurre por ejecutar dos objetos a la vez en el cliente que escriben log. Ambos leen el mismo client.exe.config y tienen el log en ALL al mismo archivo.

Reasons/Solutions:

· Each file must generate a different log file, instead of client.log they may be for instances client1.log and client2.log (for this, each one must read a different client.exe.config => execute in different directories).

· Run two clients with the same client.exe.config and with the log on, and the log name is generated each time; e.g.:

<appender name="RollingFile" type="log4net.Appender.RollingFileAppender">

<file value="client"/>

<appendToFile value="true"/>

<maximumFileSize value="9000KB"/>

<maxSizeRollBackups value="4"/>

<staticLogFileName value="false" />

<datePattern value="yyyy-MM-ddTHHmmss'.log'"/>

<layout type="log4net.Layout.PatternLayout">

<conversionPattern value="%d{HH:mm:ss,fff} %t %-5p %c{1} %x - %m%n"/>

</layout>

</appender>

E.g.: the following logs may be generated with these settings:

client2003-12-18T163808.log

client2003-12-18T163751.log

….

· Put the log OFF and without appenders in the root:

<root>

<level value="DEBUG" />

</root>

· Leave the log ON (ALL) but with output to console instead of to file.

<root>

<level value="DEBUG"/>

<appender-ref ref="ConsoleAppender"/>

</root>

------------------------------------------------------------------------------------------

    • Exception: System.Runtime.Serialization.SerializationException

Message: BinaryFormatter Version incompatibility. Expected Version 1.0. Received Version 1835627630.1699884645.

Reasons/Solutions: This exception has a message that has nothing to do with 'version incompatibility'; actually, an exception was returned from the Server and it is wrongly interpreted by the client.

This occurs in distributed applications. A possible explanation of this can be found at:

http://www.ingorammer.com/RemotingFAQ/BINARYVERSIONMISMATCH.html

In this case, see the server log; usually, the reason is that an error is occurring in the server, in the DB connection or in any procedure in the DB. If looking at the log you still do not see anything strange, try to setup client.exe.config and server.exe.config with soap format:

change <formatter ref="binary"/> for <formatter ref="soap"/> in the two config, with this format in the client the exception will be seen with a more understandable message (!= 'version incompatibility').

------------------------------------------------------------------------------------------

    • Exception: System.Net.WebException

Message: The underlying connection was closed: Unable to connect to the remote server.

Reasons/Solutions: The remoting server is not found:

When running in IIS (in ADO.NET Only, Application server host model property there is something like this: http://servername/dirvirtual), verify that:

· There is a virtual directory <dirvirtual> pointing at the server of this model

· Try to access http://servername/dirvirtual in a browser. If "not found" is returned the aspnet_wp may not be registered.

· When running as console or Windows service (in ADO.NET Only, Application server host model property there is something like this: http://servername:port), verify that:

o The service has been started and in the same port. E.g.: if port=1234 the following line must be in client.exe.config:

<wellknown type="com.genexus.distributed.DistributedObjectFactory, GxClasses" url="http://servername:1234/factory.rem"/>

And the following line must be in server.exe.config:

<channel ref="http" port="1234">

o A message of this type may also be displayed if running a program with remoting in IIS and something is modified in web.config (since in this case aspnet_wp is automatically restarted).

------------------------------------------------------------------------------------------

Applications with Publish

o The underlying connection was closed: The remote name could not be resolved.
at Microsoft.ApplicationBlocks.Updater.Logger.LogAndThrowException( String message, Exception ex )

 

An application is installed through publish. On starting the application from the client, the error described is displayed.

Reasons/Solutions:

· On starting the exe in the client, the first action is checking the server manifiest.xml to know whether installing an application update is necessary or not. If the manifesto url is not available, the error occurs. The url is withdrawn from the updaterconfiguration.config file located in the application installation directory (by default Document and Setting\User\Application Data\GxPrograms\Objetname)

· The error may also occur if the url within the manifesto in the server is wrong. The manifesto is located under the folder where it is published and is called object_Manifiest.xml.

Compilation problems

  • Fatal error U1077: 'UpdateConfigWeb.exe' : return code '0xe0434f4d'

Reasons/Solutions: Object compilation or remote reorganization, because of missing rights (verify in .NET rights for remote models )

---------------------------------------------------------------------------------------------

· Identifier expected : fatal error U1077:

The system cannot find the file specified.

Reasons/Solutions: It may occur when a value is not specified in the “Application namespace” preference.

---------------------------------------------------------------------------------------------

· gxexec "C:\Usuarios\ealmeida\mdlCR\NetOracle\blduXCEMant.cs" -r:GxBaseBuilder.dll - arg:csc="C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\csc.exe" -arg:mdlpath= "C:\Usuarios\ealmeida\mdlCR\NetOracle\"

Before compile error: El sistema no puede hallar el archivo especificado

Reasons/Solutions: strong names are being generated and the path variable is not setup with the sn.exe directory.

Note: the language is quite strict in types checking and this may cause compilation problems that will have to be corrected in the GeneXus code.
---------------------------------------------------------------------------------------------

Reorganization problems

  • Unhandled exception: System.BadImageFormatException: The format of the file 'reorganization' is invalid.

File name: "reorganization"

Reasons/Solutions: Framework 2.0 is installed and the generation is being performed with GeneXus 8.0 version or lower one.

---------------------------------------------------------------------------------------------

  • Unhandled exception

Reasons/Solutions: Starting reor.exe is not possible. Verify the following:

- that the following is installed: framework release or the framework version compatible with the generator that built the reor.exe

- Model properties, specifically Edit model\Dbms, since if a dbms different from the datasource dbms is specified the error occurs

- verify the database connection

- reorganization.dll must be where the reorganization to be executed is located

---------------------------------------------------------------------------------------------

  • Unhandled exception: System.Security.SecurityException: Request failed.
     

Description: The granted set of the failing assembly was:

<PermissionSet class="System.Security.PermissionSet" version="1">

Reasons/Solutions:

- Security rights in a Web model reorganization in the network. Refer to .Net rights section.

---------------------------------------------------------------------------------------------

  • Unhandled exception: System.IO.FileLoadException: Could not load file or assembly 'GxClasses

Description: Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'GxClasses, Version=1.0.0.1, Culture=neutral, PublicKeyToken=74ebdef9af814246' or one of its dependencies. Failed to grant minimum permission requests.

Reasons/Solutions:

- Security rights in a Win model reorganization in the network. Refer to .Net rights section.

Last update: April 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant