How to log from Debug Adapter Protocol implementation (vscode debugger extension)? - vscode-extensions

Intro: Hi folks, I'd like to ask some questions about extension developing. I'd like to create a remote lua debuger extension (for linux user, haven't found any working lua debugger). When I touch the launch button, the debug server should be started to listen (on e.g. 0.0.0.0:8723) for waiting debugger connection. And on the other side sould communicate through the DAP (debug adapter protocol) with vscode.
Problem: I'm starting to implement the my own debuger extension... But I am new in this topic and with Node.js also. My question is: How can I log (or debug) my LoggingDebugSession (where the DAP is implemented)?
I looked at the MockDebug extension example project.And tried to rewrite...
Try to log into console, my file luaDebugSession.ts:
export class LuaDebugSession extends LoggingDebugSession {
public constructor() {
super("remote-lua-debug-log.txt");
this.sendEvent(new OutputEvent("Try to log"));
console.log("Try log into console")
}
protected initializeRequest(response: DebugProtocol.InitializeResponse, args: DebugProtocol.InitializeRequestArguments): void {
this.sendEvent(new OutputEvent("Try to log 2"));
console.log("Try log into console 2")
// do something
this.sendEvent(new InitializedEvent());
}
// next code...
}
In console should be the logged output.

Related

Unable to perform get request in ktor framework

I am new to ktor and trying to create api in it.As I have downloaded project from ktor.io and opened it inside IntelliJ idea community edition then run button is showing disabled and when I am running it on right clicking on application.kt file and clicking on run application option.Its showing:
ktor.application - Responding at http://0.0.0.0:8080
When I am going to this link on webpage it is showing:
The web page at http://0.0.0.0:8080/ might be temporarily down or it may have moved permanently to a new web address.
Even if I have get route defined below is my code:
Application.kt
fun main() {
embeddedServer(Netty, port = 8080, host = "0.0.0.0") {
configureRouting()
}.start(wait = true)
}
Routing.kt
fun Application.configureRouting() {
// Starting point for a Ktor app:
routing {
get("/") {
call.respondText("Hello World!")
}
}
}
Someone let me know What is an issue and how can I resolve it.

Error handler for MBassador message/event bus

I'm using MBassador 1.2.1 message/event bus. Works well. Except that I am getting this error message in my logs, repeated for each of my instantiated bus objects:
WARN: No error handler configured to handle exceptions during publication.
Error handlers can be added to any instance of AbstractPubSubSupport or via BusConfiguration.
Falling back to console logger.
The main project page shows this example line on a BusConfiguration object:
.addPublicationErrorHandler( new IPublicationErrorHandler{...} )
…yet neither my IDE nor I see any such method on the BusConfiguration class.
How should I go about installing an error handler for Mbassador?
Add it as another property when building the configuration bus:
IBusConfiguration config = new BusConfiguration()
.addFeature(Feature.SyncPubSub.Default())
.addFeature(Feature.AsynchronousHandlerInvocation.Default())
.addFeature(Feature.AsynchronousMessageDispatch.Default())
.setProperty(Properties.Common.Id, "Command Channel Bus")
.setProperty(Properties.Handler.PublicationError, new IPublicationErrorHandler() {
#Override
public void handleError(PublicationError error) {
}
});
I had the exact same issue as you and this solved my problem.

flex 4.6 : Application crash if no internet connection

My mobile application is interact with WCF web services i build it in flash builder with Data/Services then put the url in the WSDL services
my issue is if the mobile starts with no internet connection it crashed
the error message in the console
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display::DisplayObjectContainer/getChildIndex()
at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::rawChildren_getChildIndex()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\SystemManager.as:2187]
at mx.managers::SystemRawChildrenList/getChildIndex()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\SystemRawChildrenList.as:181]
at spark.components.supportClasses::StyleableStageText/getFormIndex()[E:\dev\4.y\frameworks\projects\mobilecomponents\src\spark\components\supportClasses\StyleableStageText.as:1956]
at spark.components.supportClasses::StyleableStageText/findTopmostForm()[E:\dev\4.y\frameworks\projects\mobilecomponents\src\spark\components\supportClasses\StyleableStageText.as:1933]
at spark.components.supportClasses::StyleableStageText/updateProxyImageForTopmostForm()[E:\dev\4.y\frameworks\projects\mobilecomponents\src\spark\components\supportClasses\StyleableStageText.as:2172]
at spark.components.supportClasses::StyleableStageText/commitProperties()[E:\dev\4.y\frameworks\projects\mobilecomponents\src\spark\components\supportClasses\StyleableStageText.as:1510]
at mx.core::UIComponent/validateProperties()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:8219]
at mx.managers::LayoutManager/validateClient()
at mx.managers::LayoutManager/validateClient()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\LayoutManager.as:950]
at mx.managers::PopUpManagerImpl/addPopUp()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\PopUpManagerImpl.as:382]
at mx.managers::PopUpManager$/addPopUp()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\PopUpManager.as:193]
at spark.components::SkinnablePopUpContainer/open()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\SkinnablePopUpContainer.as:450]
at debug.ondevice.util::EnterDebugHostIPDialog/show()[/ndepot/fb_46_release_branch/ide_builder/com.adobe.flashbuilder.launching.multiplatform.contributor/utilswcs/src/debug/ondevice/util/EnterDebugHostIPDialog.mxml:47]
at debug.ondevice.util::DebuggerHostInfo$/showIPErrorDialog()[/ndepot/fb_46_release_branch/ide_builder/com.adobe.flashbuilder.launching.multiplatform.contributor/utilswcs/src/debug/ondevice/util/DebuggerHostInfo.as:129]
at mx.netmon::NetworkMonitorImpl/ioErrorHandler()[/ndepot/fb_46_release_branch/ide_builder/com.adobe.flexbuilder.monitors.network/netmonlibrary/src/mx/netmon/NetworkMonitorImpl.as:645]
i want to handle this error with message if no connection
i tried to put condition for internet connection when creation complete
protected function view1_creationCompleteHandler(event:FlexEvent):void
{
monitor = new URLMonitor(new URLRequest('http://www.adobe.com'));
monitor.addEventListener(StatusEvent.STATUS, announceStatus);
monitor.start();
}
public function announceStatus(e:StatusEvent):void {
trace("Status change. Current status: " + monitor.available);
(new AlertMsg()).open(this, false) ;
}
but it doesn't reached if no connection
Note : My target is android
Thanks in advance , for any help

Single process C#.Net windows service is showing multiple thread in CPU resource monitor?

I have developed a C#.Net windows service which is a single process.In this I'm using 2 third party Dlls one for ZIP(Ionic) and another for Excel(EPPlus).
The .EXE job is to:
Read SDF file
Write the SDF file data to SQL Server table
Generate Excel
Create ZIP
While monitoring this particular EXE in resource monitor it is showing 10 threads are running.
Note: I have not used any threading in this application.
Is OS making it 10 threads? If yes, how and why??
Related: Why does this simple .NET console app have so many threads?
I'll use a simple console application in Visual Studio 2010 that adds a reference to an assembly that spawns a thread similar to what a 3rd party library could do.
A Windows Service may have different debugging techniques, and may have various additional threads running created by the system.
Simple Console
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
ClassLibrary1.Class1.StartThread();
while (true)
{
System.Threading.Thread.Sleep(1000);
System.Diagnostics.Trace.TraceInformation("test2");
}
}
}
}
Simple API in separate class library assembly, added as a reference to the Console project
using System.Threading.Tasks;
namespace ClassLibrary1
{
public class Class1
{
public static void StartThread()
{
var t = new Task(() => {
while(true)
{
System.Threading.Thread.Sleep(1000);
System.Diagnostics.Trace.TraceInformation("test1");
}
});
t.Start();
}
}
}
Start Debugging (F5)
From the Menu Debug, Select 'Break All'
From the Menu Debug, Select Windows then Threads
The following image shows :
Main Thread, this is the console application
ClassLibrary1.Class1.StartThread.AnonymousMethod_0, this is the thread started by the referenced assembly. If Ionic or a 3Rd party API started a thread, you may see something related to its namespace.

MonoDevelop debugging error

I've recently changed to Ubuntu 11.10 (from Windows Vista).I use mono (2.8.5) as my IDE (C# VS.net before) to program.
As a quick test I want to make a console program with the following code:
using System;
namespace DeleteMe1
{
class MainClass
{
public static void Main (string[] args)
{
Console.WriteLine ("Hello World!");
Console.ReadKey ();
}
}
}
If I run the program I see a screen appear and disappear (very quickly). When I debug I get the following error:
Could not open port for debugger. Another process may be using the port.
Is someone familiar with these messages? I've already tried the following:
https://stackoverflow.com/questions/8...using-the-port
But the property key (Property key="MonoTouch.Debugger.Port" value="10000") is not available.
Whats wrong?
Thanks in advance and with best regards.