dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.85k stars 669 forks source link

The target process exited with code 0 while evaluating the function #3655

Open Pilchie opened 4 years ago

Pilchie commented 4 years ago

From @zmp2000 on Wednesday, March 11, 2020 6:50:12 PM

Hi, I have a asp.net core project which references another .net standard project which acts as a repository for retrieving database information. This repository uses NHibernate ORM and PostgreSQL connection.

The project works fine except when I try to debug any retrieved information from the Repository, the objects are lazyloaded as proxy objects just like Entity Framework does.

So when the debugger tries to evaluate the object it throws the message The target process exited with code 0 while evaluating the function 'EmpresaObjProxy.get_Informacao' [27373] quemmeatende.ui.dll' has exited with code 0 (0x0).

This problem is only occurring on Linux with VS Code I'v tested it under linux on both Vs Code and Visual Studio Comunity and both works fine.

Here my dotnet --info output: .NET Core SDK (reflecting any global.json): Version: 3.1.101 Commit: b377529961

Runtime Environment: OS Name: linuxmint OS Version: 19.3 OS Platform: Linux RID: linux-x64 Base Path: /usr/share/dotnet/sdk/3.1.101/

Host (useful for support): Version: 3.1.1 Commit: a1388f194c

.NET Core SDKs installed: 2.1.803 [/usr/share/dotnet/sdk] 2.2.402 [/usr/share/dotnet/sdk] 3.0.102 [/usr/share/dotnet/sdk] 3.1.101 [/usr/share/dotnet/sdk]

.NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.15 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.2.8 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.15 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.2.8 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.0.2 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.1 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.15 [/usr/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 2.2.8 [/usr/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 3.0.2 [/usr/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.1 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

So how can I provide more information on why the process is exiting? Because code 0 means no errors

Copied from original issue: dotnet/aspnetcore#19777

Pilchie commented 4 years ago

From @Pilchie on Wednesday, March 11, 2020 7:16:00 PM

@gregg-miskelly any ideas? What's the best way to report this?

Pilchie commented 4 years ago

From @gregg-miskelly on Wednesday, March 11, 2020 11:18:26 PM

Unfortunately the debugger doesn't know the real exit code on Linux/Mac, so ignore that part of the message.

Can someone move the issue to https://github.com/omnisharp/omnisharp-vscode? I am on parental leave right now, but hopefully someone can try to help you understand what is going on.

WardenGnaw commented 4 years ago

@zmp2000 Is it possible for you to share what the property Informacao in EmpresaObjProxy does?

Also could you enable engineLogging and share the logs?

"logging": {
   "engineLogging": true
}
daniel-scatigno commented 4 years ago

Hi @WardenGnaw , Well EmpresaObjProxy is an object created by the NHibernate framework, the framework inherits the object EmpresaObj So basically this object created by NHibernate overrides properties from the inherited class, instead of holding the property information it creates a method to load the object from the DataBase (The Lazy Load Method)

So when I try to read the property "Informacao" it is actually trying to retrieve the information from the database

I have activated the log from engineLogging as you told and heres the info

engineLogging ``` <- (E) {"seq":362,"type":"event","event":"output","body":{"category":"console","output":"The target process exited with code 0 while evaluating the function 'InformacaoProxy.ToString'."}} The target process exited with code 0 while evaluating the function 'InformacaoProxy.ToString'.<- (E) {"seq":363,"type":"event","event":"output","body":{"category":"telemetry","output":"VS/Diagnostics/Debugger/Stats/FuncEval","data":{"VS.Diagnostics.Debugger.Stats.BucketUnder20":1,"VS.Diagnostics.Debugger.vsdbg.Distribution.Name":"linuxmint","VS.Diagnostics.Debugger.Stats.BucketUnder1900":1,"VS.Diagnostics.Debugger.vsdbg.Distribution.Version":"19.3","VS.Diagnostics.Debugger.vsdbg.OSFamily":"Linux","VS.Diagnostics.Debugger.vsdbg.Version":"16.5.20117.1 commit:2a72eb2aadc6bc6a29b05ebcc642a2699007df45"}}} <- (E) {"seq":364,"type":"event","event":"output","body":{"category":"telemetry","output":"VS/Diagnostics/Debugger/MetaDataMemoryUsage","data":{"VS.Diagnostics.Debugger.TotalModuleCount":159,"VS.Diagnostics.Debugger.AdditionalModuleCount":0,"VS.Diagnostics.Debugger.TotalBytes":15335040.0,"VS.Diagnostics.Debugger.vsdbg.Distribution.Name":"linuxmint","VS.Diagnostics.Debugger.vsdbg.Distribution.Version":"19.3","VS.Diagnostics.Debugger.vsdbg.OSFamily":"Linux","VS.Diagnostics.Debugger.vsdbg.Version":"16.5.20117.1 commit:2a72eb2aadc6bc6a29b05ebcc642a2699007df45"}}} <- (E) {"seq":365,"type":"event","event":"output","body":{"category":"telemetry","output":"VS/Diagnostics/Debugger/vsdebugeng/AsyncCallstacks","data":{"VS.Diagnostics.Debugger.vsdebugeng.NumberAsyncContinuationFrames":0,"VS.Diagnostics.Debugger.vsdbg.Distribution.Name":"linuxmint","VS.Diagnostics.Debugger.vsdbg.Distribution.Version":"19.3","VS.Diagnostics.Debugger.vsdbg.OSFamily":"Linux","VS.Diagnostics.Debugger.vsdbg.Version":"16.5.20117.1 commit:2a72eb2aadc6bc6a29b05ebcc642a2699007df45"}}} <- (E) {"seq":366,"type":"event","event":"output","body":{"category":"console","output":"The program '[29264] quemmeatende.ui.dll' has exited with code 0 (0x0).\n"}} The program '[29264] quemmeatende.ui.dll' has exited with code 0 (0x0). <- (E) {"seq":367,"type":"event","event":"exited","body":{"exitCode":0}} <- (E) {"seq":368,"type":"event","event":"terminated","body":{}} -> (C) {"command":"disconnect","arguments":{"restart":false},"type":"request","seq":20} <- (E) {"seq":370,"type":"event","event":"output","body":{"category":"telemetry","output":"VS/Diagnostics/Debugger/vsdbg/DebugCompleted","data":{"VS.Diagnostics.Debugger.vsdbg.AdapterId":"coreclr","VS.Diagnostics.Debugger.vsdbg.DebugCompleted.BreakCounter":1,"VS.Diagnostics.Debugger.vsdbg.Distribution.Name":"linuxmint","VS.Diagnostics.Debugger.vsdbg.Distribution.Version":"19.3","VS.Diagnostics.Debugger.vsdbg.OSFamily":"Linux","VS.Diagnostics.Debugger.vsdbg.Version":"16.5.20117.1 commit:2a72eb2aadc6bc6a29b05ebcc642a2699007df45"}}} <- (R) {"seq":371,"type":"response","request_seq":20,"success":true,"command":"disconnect"} <- (R) {"seq":369,"type":"response","request_seq":19,"success":true,"command":"variables","message":"","body":{"variables":[{"name":"this","value":"{QuemMeAtende.UI.Startup}","type":"QuemMeAtende.UI.Startup","presentationHint":{"kind":"data","attributes":["canHaveObjectId"]},"evaluateName":"this","variablesReference":1001,"memoryReference":"0x00007F5F280DE318"},{"name":"services [IServiceCollection]","value":"{Microsoft.Extensions.DependencyInjection.ServiceCollection}","type":"Microsoft.Extensions.DependencyInjection.IServiceCollection {Microsoft.Extensions.DependencyInjection.ServiceCollection}","presentationHint":{"kind":"data","attributes":["canHaveObjectId"]},"evaluateName":"services","variablesReference":1002,"memoryReference":"0x00007F5F280D3CB8"},{"name":"gestor","value":"Internal error retrieving local value.","presentationHint":{"attributes":["readOnly","failedEvaluation"]},"variablesReference":0}]}} ```
WardenGnaw commented 4 years ago

Could you add more to the logs before seq: "362"? That might have more information on what is happening before it tries to evaluate InformacaoProxy.ToString

daniel-scatigno commented 4 years ago

I'll include the whole log from the beginning (I'm starting the application and pausing just after the ConfigureServices) and then I try to evaluate the object.

I have attached the log as a txt file

log.txt

jamiepenney commented 4 years ago

I'm having the same issue with Entity Framework Core objects - the debugger is crashing while trying to evaluate any proxied properties. EF Core uses Castle.Proxy from what I can tell. Would it be useful to get more logging from my crashes?

gregg-miskelly commented 4 years ago

@jamiepenney if you have a repro that you could share, that would be helpful. This is unlikely to be an issue with this extension, so it is probably unlikely that further debugger logs would help.

jamiepenney commented 4 years ago

@gregg-miskelly sure, I've made one based on my company's standard template here https://github.com/IonTechnologies/DebuggerFailureRepro

It's pretty much the standard ASP.NET Core template, plus Entity Framework Core with a Postgres database and ASP.NET Identity.

I've put reproduction steps in the readme. Let me know if it they don't work - I am working on OSX, if that makes a difference.

The error message I get is "The target process exited with code 0 while evaluating the function 'Castle.Proxies.UserProxy.UserData.get'.The program '[78709] debug_failure.dll' has exited with code 0 (0x0)."

To me, it seems like it's blowing up while trying to access the lazy-loaded collection.

gregg-miskelly commented 4 years ago

Thanks! I was able to reproduce the problem. I will see if I can figure out what is going on...

gregg-miskelly commented 4 years ago

What is going on is that the target process is running into an access violation. It appears to be the same problem as in https://github.com/dotnet/runtime/issues/12739. I will leave this bug active for now, and I added a note to that bug with your repro.

jamiepenney commented 4 years ago

Thanks @gregg-miskelly!