One of these days, I needed again to debug an extension and was not able to do it, so looked again how to debug an extension. To debug an extension is possible through IIS Attach, create a new project and debug through the new project or also through the log (ServiceCenter).

The first method i will explain is through IIS Attach

1)Acess to the server
2) Microsoft Visual Studio installed in the server

1) In the Integration Studio, select Options (EDIT->OPTIONS) check if in the TAB .NET, the last field is filled (.NET Compiler Tool Options) with the option DEBUG, if is with RELEASE change it to DEBUG:
Example: /nologo /verbosity:minimal /target:Rebuild /property:Configuration=Debug

2) Open the project in Microsoft Visual Studio and edit BUILD properties for the following options:

3) Build the project and publish the extension (Ensure that the PDB file is included in our Extension, if not select it, right click and choose Include in the project) 
4) Republish the espace that uses the extension (if is a action that is used in other espaces, they need to be republish too)
5) Open the page and activate the option that calls the extension (this is very important because it is this action that causes the module to be created on the server)
6) Access the server locally to record the extent of the project (using the Integration Studio or simply copying from another machine there)
7) Open the Microsoft Visual Studio with Run as Administrator (important) and open the extension project(visual studio) 

8) Now we go to attach to Process IIS(w3wp.exe) 

Note: The option "Show processes in all sessions" need to be selected
9) Access to Modules (and wait for the press, because it takes a while)

10) Load the PDB file (select your extension, and the espace used in step 5)

If the Symbol is not loaded is necessary the following step:
  • Open the Symbol settings

  • Add the project BIN directory to the directory list and press OK

  • Procedure to load the Symbol information

11) Add your breakpoints, and its done. When you load the page (always on the server) will stop ate the breakpoint. 

12) After the debug, we need to remove the PDB from the extension (step 3) and republish the extension without Debug  (that we change on step 1).
So we go back to step 1 and change from Debug to Release and now step 3 to remove the PDB file. Now you can publish the final version of your extension.

2) By LOG

 We can use the "OutSystems.HubEdition.RuntimePlatform.Log" to  log messages. 
 Here's an example: 

OutSystems.HubEdition.RuntimePlatform.Log.GeneralLog log = new OutSystems.HubEdition.RuntimePlatform.Log.GeneralLog();
        log.Write(System.DateTime.Now, AppInfo.GetAppInfo().OsContext.Session.SessionID, AppInfo.GetAppInfo().eSpaceId, AppInfo.GetAppInfo().Tenant.Id, AppInfo.GetAppInfo().OsContext.Session.UserId, message, "Warning", "ModuleName", "0");

The messages will be appear in Service Center (monitoring).

3) By Project

(António Chinita Tutorial)

While in VS add a new project to the current solution (I'd recommend a command line application) and set it as the StartUp project.
Now reference the compiled dll for your extension (\ExtensionName\Source\NET\Bin\OutSystems.NssExtensionName.dll) in the new project, and in code as well with something like: using OutSystems.NssExtensionName;

Now in the Main() you can create instances of the class CssExtensionName (OutSystems.NssExtensionName.CssExtensionName), that has all the actions of the extension as methods.
You can also create instantes of your records/recordlists, they're avaliable directly at  OutSystems.NssExtensionName.

This is how to debug an extension like a console application.

Here's a screenshot of how it will look



Is It possible to make a video explaining the version 1? I dont find the pdb file

While the original how-to may be a few years old, we thought this topic merited a video how-to, so without further ado:

Appears that the embedded video isn't showing up for case you aren't seeing the embedded video, the URL is here: