Is possible to debug a extension?
Hi all,
I am developing a extension, and is something wrong in the extension, how can i debug the extension?

Best regards,
Rank: #302
Hi Luis, 

you can use "OutSystems.HubEdition.RuntimePlatform.Log" and use some  log messages like the above

log.Write(System.DateTime.Now, app.OsContext.Session.SessionID, app.eSpaceId, app.Tenant.Id, app.OsContext.Session.UserId, message, "Warning", "ModuleName", "0"); 

The messages will be audit in service center.

Just found another way, attach the process to iis, just like in this picture.

Go to Debug-> Attach to process

and will show this window, now we select  show process in all session and select the w3wp.exe to select the iis process. (let the visual studio open)

Now we run our espace and it will stop in the breakpoint in the visual studio project.

Rank: #302
Cool you found it Luis...

That method if you can have access to the server ;) otherwise you just log it.


Rank: #19667
I am currently trying to post debug code into an extension using the OutSystems.HubEdition.RuntimePlatform.Log collection, but I can't find a way to actually write to the error log.  Which command is needed for it to display in the Error Log under the Monitoring tab?


Hi Josh, you can do it this way,

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");

Rank: #5418
Hello everyone,

I am trying to get the "attach to process" working with VS2008 and OS running on the same machine)

When I want to attach the extension (C# code in VS2008)  to a process (Tools > Attach to Process)  I do not see the mentioned w3wp.exe process.
I think in vs2008 the process to attach should be aspnet_wp.exe. But that does not work, does not stop on breakpoint in VS.

I used this method in the past with success with earlier version of OS. It is very handy and saves a lot of developing time of an extension.

Is there someone who know how to get this working (again).

Best regards,

Rank: #7
Yes, I also need to know how to debug within VS, but on a different machine. I'm able to attach to w3p just fine, but it's saying that no debug symbols are loaded, so it is unable to debug. What do I need to do to allow my remote debug session to attach properly?


Rank: #167
What I usually do to debug in VS is to change the project from Class Library to Windows Application and add a new class file with an entry point. Then I instantiate the extension class and debug the actions. Ofcourse this is not real time. I must pass the parameters myself.
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
Rank: #7
Thanks for the information!

I would really prefer to attach to the remote system for debugging, because the extension I am working with takes a very large, deep data object as input. :(

Are there any ways to properly attach to the remote process and get debug symbols loaded?

Thanks again!

Gonçalo Borrêga
Rank: #0
Hi Justin,

For debug symbols to be created, the extension must be built in Debug mode.
When the extension is loaded, Integration Studio creates a folder for you with the name of the extension. That folder, on it's root has a Compile.bat batch file (it should be there at least after you "Verify & Save" the extension). You should edit that batch file and replace the compilation mode from Release to Debug

"C:\Windows\Microsoft.NET\Framework\v3.5\MSBuild.exe" "D:\Projects\XmlRecords\XmlRecords\Source\NET\XmlRecords.sln" /nologo /verbosity:minimal /target:Rebuild /property:Configuration=Release


"C:\Windows\Microsoft.NET\Framework\v3.5\MSBuild.exe" "D:\Projects\XmlRecords\XmlRecords\Source\NET\XmlRecords.sln" /nologo /verbosity:minimal /target:Rebuild /property:Configuration=Debug

After publishing the extension you should be able to attach properly to w3wp and have Visual Studio loading the debug symbols.

For attaching Visual Studio to a remote server, try following the instructions at https://msdn.microsoft.com/en-us/library/bt727f1t.aspx

Gonçalo Borrêga
Rank: #7
Thanks! I will give this a try next time!

Rank: #9
If someone is looking for the way to do it in java it is very similar, but since the thread does not talk about it, here it goes:

 outsystems.hubedition.runtimeplatform.log.GeneralLog log = new GeneralLog();
log.write(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);

Ricardo Silva
Rank: #0
If you're going about auditing stuff to the general log, it's a hell of a lot easier to use Audit than to create a GeneralLog by hand and write it to the log:

One of these days, I needed again to debug an extension and was not able to do it, so looked again how to debug from the IIS attach and found several tutorials, and through them i was able to do it again. Heres my tutorial,

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.

Rank: #105
Great Job Luis! If you have not already done so, I suggest you to post this in the Guides & How-tos section too. 

are there any steps to do the samething on javastack?
Rank: #1217
I find a quick way to debugging in C# is making a startup console application that takes input and just prints the responses. This is probably only viable for small extensions, though. 
Rank: #39315
For some simple debugging you can add a main() method to run the extension within Eclipse.