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

[BUG] "Error processing launch options at field: program" when debugging for Android #1578

Open
baebranch opened this issue Nov 2, 2024 · 6 comments
Assignees
Labels
area-maui bug Something isn't working

Comments

@baebranch
Copy link

baebranch commented Nov 2, 2024

Describe the Issue

When debugging a .NET Maui app on the android platform with a device selected the error message "Error processing launch options at field: program" pops up. No error output. Nothing else to go on. The app also freezes on the default ".NET" splash screen. Not sure if this would then be related to this issue #1521 .

Steps To Reproduce

  1. Install .NET MAUI extension

  2. Select ".NET: New Project" in vscode command palette

  3. Configure target debug device to "Android" by clicking "{}" in bottom status bar
    Image

  4. "F5" to start debugging

  5. Pop up shows "Error processing launch options at field: program"
    Image

Expected Behavior

The app should start debugging on the android emulator

Environment Information

  • .NET MAUI vscode extension version: v1.5.19 (pre-release)
  • C# Dev Kit vscode extension version: v1.12.37 (pre-release)
  • C# vscode extension version: v2.50.27
  • dotnet --version 8.0.204
  • dotnet workload list output
Installed Workload Id      Manifest Version      Installation Source
--------------------------------------------------------------------
android                     34.0.143/8.0.100       SDK 8.0.200
maui                        8.0.82/8.0.100         SDK 8.0.200
maui-android                8.0.82/8.0.100         SDK 8.0.200
  • .Net Maui vscode Output
ANDROID ENVIRONMENT STATUS: 11/2/2024, 11:36:29 AM
 
Here is the status of your Android development environment:
 
Required components:
 
	✓ Java SDK - INSTALLED (version '17.0.6')
		- Path: 'C:\Program Files\Java\jdk-17' (Workload)
		- Recommended detected locations:
			- 'c:\program files\common files\oracle\java' (PATH)

	✓ Android SDK - INSTALLED
		- Path: 'C:\Users\<user>\AppData\Local\Android\sdk' (VSCode settings)
 
		✓ platforms/android-34 - INSTALLED (version '3')
		✓ build-tools/34.0.0 - INSTALLED (version '34.0.0')
		✓ platform-tools - INSTALLED (version '35.0.2')
		✓ cmdline-tools/11.0 - INSTALLED (version '11.0')
 
Optional components:
 
	✓ Android Virtual Device (AVD) - COMPLETE
		- AVD Path: 'C:\Users\<user>\.android\avd'
		- AVD devices - DETECTED ('Pixel8API35')
 
		✓ emulator - INSTALLED (version '35.2.10')
		✓ system-images/android-34/google_apis/x86_64 - INSTALLED (version '14')
		✓ system-images/android-35/google_apis_playstore/x86_64 - INSTALLED (version '8')
 
IMPORTANT:
- If you are sharing the Android SDK location with Android Studio, the recommended way to install/update the SDK and accept licenses is by using Android Studio.
@baebranch baebranch added the bug Something isn't working label Nov 2, 2024
@baebranch baebranch changed the title [BUG] "MSBUILD : error MSB1008: Only one project can be specified" caused by double quotes [BUG] "Error processing launch options at field: program" when debugging for Android Nov 2, 2024
@mauroa
Copy link
Member

mauroa commented Nov 4, 2024

Hi @baebranch, according to the repro steps you provide, you shouldn't expect the app to start debug if you are selecting an "Android (build only)". The purpose of that build only debug target is to just build your project, because for now the "right click > Build solution" option is not supported for MAUI.
Could you please try to select a real Android emulator or device and try to debug again, seeing if that makes any change in the repro?
Thanks

@mauroa mauroa added the needs-more-info Needing more information, waiting on OP label Nov 4, 2024
@mauroa mauroa self-assigned this Nov 4, 2024
@baebranch
Copy link
Author

Hi @baebranch, according to the repro steps you provide, you shouldn't expect the app to start debug if you are selecting an "Android (build only)". The purpose of that build only debug target is to just build your project, because for now the "right click > Build solution" option is not supported for MAUI. Could you please try to select a real Android emulator or device and try to debug again, seeing if that makes any change in the repro? Thanks

Sorry I came across a few bugs and didn't update the issue properly. That was related to a pre-launch command that was doubled quoted and causing errors, which I replaced myself. However I've selected an android emulator device, I was just indicating that in the build only option it built with my updated prelaunch build task, loads onto the emulated device and then then shows that error popup.

Copy link

github-actions bot commented Nov 6, 2024

@mauroa, the 'needs-more-info' label has been removed upon receiving further response from the original bug filer.

@github-actions github-actions bot removed the needs-more-info Needing more information, waiting on OP label Nov 6, 2024
@mauroa
Copy link
Member

mauroa commented Nov 19, 2024

Thanks @baebranch.

Regarding this: "That was related to a pre-launch command that was doubled quoted and causing errors, which I replaced myself.", I'm not clear if you got unblocked or if you are still having issues. In case you still have issues, could you share the launch.json with the custom steps that you are using?

@mauroa mauroa added the needs-more-info Needing more information, waiting on OP label Nov 19, 2024
@baebranch
Copy link
Author

Thanks @baebranch.

Regarding this: "That was related to a pre-launch command that was doubled quoted and causing errors, which I replaced myself.", I'm not clear if you got unblocked or if you are still having issues. In case you still have issues, could you share the launch.json with the custom steps that you are using?

I upgraded to .net 9 and the app loads correctly on the emulator but gets stuck at "waiting for debugger" message or just stuck on the splash screen. There are also issues recognizing the running AVD and discovering all of the configured AVDs.

This is the modified task in tasks.json

{
	"version": "2.0.0",
	"tasks": [
		{
			"label": "Build",
			"type": "shell",
			"command": "C:\\WINDOWS\\System32\\cmd.exe",
			"args": [
				"/d",
				"/c",
				"dotnet",
				"build",
				"-t:Run",
				"-p:Configuration=Debug",
				"-f",
				"net9.0-android",
				"-p:AdbTarget=-s%20emulator-5554",
				"-p:AndroidAttachDebugger=true",
				"-p:AndroidSdbTargetPort=53027",
				"-p:AndroidSdbHostPort=53027",
				"-p:CustomAfterMicrosoftCSharpTargets=\"c:\\Users\\<user>\\.vscode\\extensions\\ms-dotnettools.dotnet-maui-1.6.4-win32-x64\\dist\\resources\\Custom.After.Microsoft.CSharp.targets\"",
				"-p:MauiVSCodeBuildOutputFile=\"C:\\Users\\<user>\\AppData\\Local\\Temp\\dotnet-maui\\maui-vsc-36c1a1e8-5bd3-402f-a64d-8d8cc8307f89.json\"",
				"-p:AndroidSdkDirectory=\"C:\\Users\\<user>\\AppData\\Local\\Android\\sdk\"",
				"-p:JavaSdkDirectory=\"C:\\Program Files (x86)\\Android\\openjdk\\jdk-17.0.12\"",
				"C:\\code\\csharp\\new_test\\MauiApp1\\MauiApp1.csproj"
			],
			"problemMatcher": [
				"$msCompile",
				"maui-problem-matcher-location",
				"maui-problem-matcher",
				"maui-problem-matcher-location-multiline",
				"maui-problem-matcher-multiline"
			],
		}
	]
}

Copy link

@mauroa, the 'needs-more-info' label has been removed upon receiving further response from the original bug filer.

@github-actions github-actions bot removed the needs-more-info Needing more information, waiting on OP label Nov 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-maui bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants