JaneySprings / DotNet.Meteor

A VSCode extension that can run and debug .NET apps (Xamarin, MAUI, Avalonia)
https://marketplace.visualstudio.com/items?itemName=nromanov.dotnet-meteor
MIT License
269 stars 10 forks source link

Getting error Broken TCP connection detected, aborting ipc connection. - macOS #106

Closed kavitap081 closed 3 months ago

kavitap081 commented 4 months ago

Hi, While trying to profile , suddenly i have started getting error "Broken TCP connection detected, aborting ipc connection." . It was working fine till yesterday. Already tried changing port number of MonoSdbDebuggerPortAndroid and ProfilerHost but its not working.

image

I am using .VSIX version provided in bug https://github.com/JaneySprings/DotNet.Meteor/issues/103

JaneySprings commented 4 months ago

Seems like your application is shutting down with an exception. Can you test it without profiler?

kavitap081 commented 4 months ago

No, i ran with debugger configuration with .NET Meteor , and here also getting "TCP connection refused" error. However, i am able to install ans run app successfully from Visual studio for mac

Error screenshot in debugger configuration ( i tried port 13000 for MonoSdbDebuggerPortAndroid):

image

JaneySprings commented 4 months ago

failed to connect to socket 'tcp:13000': Connection refused Can you please delete the bin obj folders and try again? I have never seen this error before. Maybe the debugger was not added to the output apk file.

jmichas commented 1 week ago

I am getting this too on VSCode mac. My app runs fine if I switch to debugging mode, but trying to profile it disconnects and the app on the emulator stops. I did have to add this to my launch.json config to get it to work with a running emulator:

"device": {
    "serial": "${command:dotnet-meteor.activeDeviceSerial}",
    "platform": "android",
    "is_emulator": true
}

My app does not get past the android splash screen activity essentially.

Not sure what to do. How do you manage the dotnet-dsrouter settings from the meteor config?

Thanks.

JaneySprings commented 1 week ago

Hi @jmichas ! I can't reproduce it in a simple app (dotnet new maui): image

It will be nice If you can send me an example app

jmichas commented 1 week ago

@JaneySprings Yeah, that is tough. My project is pretty big so not sure I can trim it down to something to use as an example.

How can I change the port that the IPC server is using? Or other settings regarding how everything connects? I want to rule out a simple port conflict or anything like that.

I do get a little bit of tracing info in the .speedscope.json file but it is broken so it has just '???' and no details.

Do you think it is the 'suspend' setting for dotnet-dsrouter? I think that makes it wait for the profiler to connect before continuing, maybe it doesn't connect so the app quits? I don't know a ton about this stuff, just been trying to research how I can fix this and profile my app.

Thanks!

JaneySprings commented 1 week ago

How can I change the port that the IPC server is using?

You can change the following setting in VSCode (or you can kill all running dsrouter processes): image

Also you can try to profile your application manually with this official instruction (https://github.com/dotnet/android/blob/main/Documentation/guides/tracing.md). Let me know if everything is OK with manual way.

jmichas commented 6 days ago

Ok, thanks for the info. I was finally able to run it manually, but it only works if I use nosuspend. When I use the default suspend in adb shell setprop debug.mono.profile '10.0.2.2:9000,suspend,connect' it causes a VTable error in my app for a class in Shiny.Core, there seems no way to prevent the VTable error that I can figurer out.

The error is likely why I couldn't get it to work in the first place. It only occurs if the app pauses for the trace to begin. In any other build environment or setting (debug/release) it works as expected with no errors.

A bit of a bummer because the trace can't wait for the app and vice versa so startup tracing is inconsistent since it is manually started right after the app starts.

JaneySprings commented 6 days ago

Maybe we need a “trace-manual” profiler mode with “nosuspend” parameter? In this mode you can’t trace app startup, but you can connect to the application at any time

jmichas commented 6 days ago

Yeah, it would be good because then if someone had my problem they could easily run it on nosuspend and see if it works, then the user has it narrowed down. Also, for me, I don't have control over the library that is causing the vtable issue so it will never work in suspend.

Is there any way to monitor the build process and when it gets to launching the app automatically fire off the trace start?

JaneySprings commented 6 days ago

Unfortunately, no. I created a separate issue for this feature: https://github.com/JaneySprings/DotNet.Meteor/issues/129 I think that I can implement this feature in the 6.0.0 version with iOS for Windows support.