Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dotnet Android broken debugging (and runtime?) #104265

Open
arivoir opened this issue Jul 1, 2024 · 3 comments
Open

Dotnet Android broken debugging (and runtime?) #104265

arivoir opened this issue Jul 1, 2024 · 3 comments
Labels
area-Debugger-mono untriaged New issue has not been triaged by the area owner

Comments

@arivoir
Copy link

arivoir commented Jul 1, 2024

Description

For some months we've been having issues to debug native Android libraries, if I set a breakpoint in the application it works, but if I set a breakpoint in a library it is completely ignored.

Additionally, I see the following in the Debug console

System.IndexOutOfRangeException: Index was outside the bounds of the array.
at Mono.Debugger.Soft.Connection.decode_int(Byte[] packet, Int32& offset) in D:\a_work\1\s\External\debugger-libs\Mono.Debugger.Soft\Mono.Debugger.Soft\Connection.cs:line 732
at Mono.Debugger.Soft.Connection.Method_GetLocalsInfo(Int64 id) in D:\a_work\1\s\External\debugger-libs\Mono.Debugger.Soft\Mono.Debugger.Soft\Connection.cs:line 2308
at Mono.Debugger.Soft.MethodMirror.GetLocals() in D:\a_work\1\s\External\debugger-libs\Mono.Debugger.Soft\Mono.Debugger.Soft\MethodMirror.cs:line 276
at Mono.Debugger.Soft.StackFrame.GetVisibleVariableByName(String name) in D:\a_work\1\s\External\debugger-libs\Mono.Debugger.Soft\Mono.Debugger.Soft\StackFrame.cs:line 246
at Mono.Debugging.Soft.SoftDebuggerAdaptor.OnGetLocalVariable(EvaluationContext ctx, String name) in D:\a_work\1\s\External\debugger-libs\Mono.Debugging.Soft\SoftDebuggerAdaptor.cs:line 1072
at Mono.Debugging.Evaluation.NRefactoryExpressionEvaluatorVisitor.VisitIdentifierName(IdentifierNameSyntax node) in D:\a_work\1\s\External\debugger-libs\Mono.Debugging\Mono.Debugging.Evaluation\NRefactoryExpressionEvaluatorVisitor.cs:line 660
at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxVisitor1.Visit(SyntaxNode node) at Mono.Debugging.Evaluation.NRefactoryExpressionEvaluatorVisitor.VisitMemberAccessExpression(MemberAccessExpressionSyntax node) in D:\a\_work\1\s\External\debugger-libs\Mono.Debugging\Mono.Debugging.Evaluation\NRefactoryExpressionEvaluatorVisitor.cs:line 979 at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxVisitor1.Visit(SyntaxNode node)
at Mono.Debugging.Evaluation.NRefactoryExpressionEvaluatorVisitor.VisitBinaryExpression(BinaryExpressionSyntax node) in D:\a_work\1\s\External\debugger-libs\Mono.Debugging\Mono.Debugging.Evaluation\NRefactoryExpressionEvaluatorVisitor.cs:line 578
at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxVisitor`1.Visit(SyntaxNode node)
at Mono.Debugging.Evaluation.ObjectValueAdaptor.GetExpressionValue(EvaluationContext ctx, String exp) in D:\a_work\1\s\External\debugger-libs\Mono.Debugging\Mono.Debugging.Evaluation\ObjectValueAdaptor.cs:line 1418

And the crash show some exception that I can not understand how it happens
image
The debugging shows nothing for the local field "thickness" but three dots, and I can not comprehend how something can be null here, when there is an if before that to avoid it, and the properties are of type double.

We're in a critical situation where we can not continue developing, because the debugger doesn't work, and the runtime exceptions are incomprehensible.

Steps to Reproduce

I don't have a reproduction steps for now

Link to public reproduction project repository

No response

Version with bug

8.0.3 GA

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

6.0

Affected platforms

Android

Affected platform versions

No response

Did you find any workaround?

No

Relevant log output

System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at Mono.Debugger.Soft.Connection.decode_int(Byte[] packet, Int32& offset) in D:\a\_work\1\s\External\debugger-libs\Mono.Debugger.Soft\Mono.Debugger.Soft\Connection.cs:line 732
   at Mono.Debugger.Soft.Connection.Method_GetLocalsInfo(Int64 id) in D:\a\_work\1\s\External\debugger-libs\Mono.Debugger.Soft\Mono.Debugger.Soft\Connection.cs:line 2308
   at Mono.Debugger.Soft.MethodMirror.GetLocals() in D:\a\_work\1\s\External\debugger-libs\Mono.Debugger.Soft\Mono.Debugger.Soft\MethodMirror.cs:line 276
   at Mono.Debugger.Soft.StackFrame.GetVisibleVariableByName(String name) in D:\a\_work\1\s\External\debugger-libs\Mono.Debugger.Soft\Mono.Debugger.Soft\StackFrame.cs:line 246
   at Mono.Debugging.Soft.SoftDebuggerAdaptor.OnGetLocalVariable(EvaluationContext ctx, String name) in D:\a\_work\1\s\External\debugger-libs\Mono.Debugging.Soft\SoftDebuggerAdaptor.cs:line 1072
   at Mono.Debugging.Evaluation.NRefactoryExpressionEvaluatorVisitor.VisitIdentifierName(IdentifierNameSyntax node) in D:\a\_work\1\s\External\debugger-libs\Mono.Debugging\Mono.Debugging.Evaluation\NRefactoryExpressionEvaluatorVisitor.cs:line 660
   at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxVisitor`1.Visit(SyntaxNode node)
   at Mono.Debugging.Evaluation.ObjectValueAdaptor.GetExpressionValue(EvaluationContext ctx, String exp) in D:\a\_work\1\s\External\debugger-libs\Mono.Debugging\Mono.Debugging.Evaluation\ObjectValueAdaptor.cs:line 1418
Copy link
Contributor

github-actions bot commented Jul 1, 2024

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@arivoir
Copy link
Author

arivoir commented Jul 1, 2024

I also reported here https://developercommunity.visualstudio.com/t/Debugging-an-native-Android-library-is-b/10694337?

I found a repro case
AndroidDebuggerIssue.zip

The bug regarding debugger appears when library target net7 and application net8

@samhouts samhouts transferred this issue from dotnet/maui Jul 1, 2024
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Jul 1, 2024
Copy link
Contributor

Tagging subscribers to this area: @thaystg
See info in area-owners.md if you want to be subscribed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Debugger-mono untriaged New issue has not been triaged by the area owner
Projects
None yet
Development

No branches or pull requests

1 participant