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

Deploy target #2905

Merged
merged 3 commits into from
Apr 3, 2019
Merged

Deploy target #2905

merged 3 commits into from
Apr 3, 2019

Conversation

xtmq
Copy link
Contributor

@xtmq xtmq commented Mar 31, 2019

When adb fails it is difficult to understand thats going on especially from IDE where an user usually observes only error messages, something like:

MyAndroidProject
   ...\Xamarin\Android\Xamarin.Android.Common.targets(3281,3): error MSB3073: 
The command ""C:\Program Files (x86)\Android\android-sdk\platform-tools\\adb" -s emulator-5554 install -r "bin\Debug\com.companyname.MyAndroidProject-Signed.apk"" exited with code 1.

It is better to have an error message like

MyAndroidProject
  ...\Xamarin\Android\Xamarin.Android.Common.targets(3285,9): error : 
The command ""C:\Program Files (x86)\Android\android-sdk\platform-tools\\adb" -s emulator-5554 install -r "bin\Debug\com.companyname.MyAndroidProject-Signed.apk"" exitied with code 1: 
adb: failed to install bin\Debug\com.companyname.MyAndroidProject-Signed.apk: Failure [INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION: Failed to parse /data/app/vmdl192544199.tmp/base.apk: AndroidManifest.xml]

Copy link
Member

@jonathanpeppers jonathanpeppers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xtmq is this the actual error message you get from the IDE? Can you paste what you get in the error pad?

I'm asking because that code is in the proprietary part of Xamarin.Android. It would be Xamarin.Android.Common.Debugging.targets, an MSBuild task called <InstallPackageAssemblies/>.

@xtmq
Copy link
Contributor Author

xtmq commented Apr 1, 2019

I use Xamarin Android SDK built from sources so I have no Xamarin.Android.Common.Debugging.targets there. So I see the message as I wrote above =)

@xtmq
Copy link
Contributor Author

xtmq commented Apr 1, 2019

Or are you going to open source these targets? I have not read about that....

@jonathanpeppers
Copy link
Member

No, I just wanted to make sure we didn’t have something else to fix, thanks.

@xtmq
Copy link
Contributor Author

xtmq commented Apr 1, 2019

No, deploy in VS SDK works much better then the default one...

@jonathanpeppers
Copy link
Member

@monojenkins build

@jonpryor
Copy link
Member

jonpryor commented Apr 3, 2019

What does it look like within the IDE? Behold, a test app!

Scratch.IdeErrorMessageDisplay.zip

Scratch.IdeErrorMessageDisplay.targets contains the three variations discussed on this bug: CreateErrorsOriginal is the original suggestion, CreateErrorsItemGroupMultiLine was my suggestion, and CreateErrorsItemGroupSingleLine is @jonathanpeppers' suggestion.

Open Scratch.IdeErrorMessageDisplay.targets, change the $(BuildDependsOn) property at the top to specify a particular target, then hit Build.

Visual Studio for Mac Results

CreateErrorsOriginal results in a single error message, with all output on a single line:
Errors-Original

I personally don't like it.

CreateErrorsItemGroupMultiLine results in three separate error messages, a "summary" line and then the two lines of output from the failing command:
Errors-ItemGroupMultiLine

CreateErrorsItemGroupSingleLine results in a single error message, but -- unexpectedly! -- has a disclosure triangle. When it's first shown, only the first line of output is displayed:
Errors-ItemGroupSingleLine-Collapsed

Expand the disclosure triangle, and all the lines are shown:
Errors-ItemGroupSingleLine-Expanded

This is my favorite rendition on macOS. I need to try Windows.

@jonpryor
Copy link
Member

jonpryor commented Apr 3, 2019

What about Windows & Visual Studio 2017?

CreateErrorsOriginal:
CreateErrorsOriginal

CreateErrorsItemGroupMultiLine:
CreateErrorsItemGroupMultiLine

CreateErrorsItemGroupSingleLine:
CreateErrorsItemGroupSingleLine

@jonpryor
Copy link
Member

jonpryor commented Apr 3, 2019

Note: In order to get things to fail on Windows, I had to change $(_Command) to use & instead of ;:

    <_Command>echo 'this is line 1' &amp; echo 'line 2' &amp; exit 1</_Command>

Overall, on Windows I think CreateErrorsItemGroupSingleLine is the only good one. CreateErrorsItemGroupMultiLine has some weird ordering, and CreateErrorsOriginal will become unreadable as output length increases.

Emit an ADB0000 error containing multiple lines.
@dnfclas
Copy link

dnfclas commented Apr 3, 2019

CLA assistant check
All CLA requirements met.

@jonpryor
Copy link
Member

jonpryor commented Apr 3, 2019

@monojenkins build

@xtmq
Copy link
Contributor Author

xtmq commented Apr 3, 2019

Thanks, your version indeed looks better =)

@jonpryor jonpryor merged commit d43128c into dotnet:master Apr 3, 2019
jonpryor pushed a commit that referenced this pull request Nov 21, 2022
Context: b002dc3
Context: #2905 (comment)

If an error occurs when compiling or linking native assembler files
generated by .NET Android, we log an error which doesn't contain any
useful information:

	error XA3006: Could not compile native assembly file: compressed_assemblies.x86.ll

The real cause of the issue is logged as well, but not as an error;
it's visible in the Diagnostic log as a "plain" message, which is not
immediately accessible to the user experiencing the issue.

Keep logging the output messages of the assembler and linker programs
as before, but whenever an error occurs, log their entire output
(stdout and stderr) as a single MSBuild message with newlines between
each each line of stdout/stderr.  This will render within Visual Studio
as a multi-line error message ("CreateErrorsItemGroupSingleLine" in
#2905).
jonathanpeppers pushed a commit that referenced this pull request Nov 30, 2022
Context: b002dc3
Context: #2905 (comment)

If an error occurs when compiling or linking native assembler files
generated by .NET Android, we log an error which doesn't contain any
useful information:

	error XA3006: Could not compile native assembly file: compressed_assemblies.x86.ll

The real cause of the issue is logged as well, but not as an error;
it's visible in the Diagnostic log as a "plain" message, which is not
immediately accessible to the user experiencing the issue.

Keep logging the output messages of the assembler and linker programs
as before, but whenever an error occurs, log their entire output
(stdout and stderr) as a single MSBuild message with newlines between
each each line of stdout/stderr.  This will render within Visual Studio
as a multi-line error message ("CreateErrorsItemGroupSingleLine" in
#2905).
@github-actions github-actions bot locked and limited conversation to collaborators Jan 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants