You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
When using FastDeployment get error message XA0136: The 'run-as' command failed with 'run-as: Package 'packagename' has corrupt installation #7821
Windows VS 2020 Latest release (including Beta version), Android 7.1.1 Custom Device
Description
While trying the work around for issue #7521 (comment), which involves using Fast Deployment, I encounter the error
XA0136: The 'run-as' command failed with 'run-as: Package 'packagename' has corrupt installation'.
The currently installation of the package in corrupt. Please manually uninstall the
package from all the users on device and try again. If that does not work you can disable Fast Deployment.
Fast Deployment can be disabled in the Visual Studio project property pages or edit the project file in a text editor and set the 'EmbedAssembliesIntoApk' MSBuild property to 'true'.
Xamarin.Android project running on custom device, Android 7.1.1, armv7 chip
Visual Studio 2022 17.5.0 Preview 6.0 (but also experienced in on previous versions)
Currently there is a bug that is preventing from running with debugger (mscorblib cannot load) that has a fix that isn't released yet, the work around is to use Fast Deployment
Run with debug and Fast Deployment enabled
Observe error about run-as command failed due to corrupt installation
Without Fast Deployment, the app will start then crash due to the mscorlib error, but then you can relaunch the app without debugger and it runs fine
With fast deployment, even after the initial attempt at it running, trying to run it again will result in an immediate crash
Did you find any workaround?
No
Relevant log output
XA0136: The 'run-as'command failed with 'run-as: Package 'packagename' has corrupt installation'.
The currently installation of the package in corrupt. Please manually uninstall the
package from all the users on device and try again. If that does not work you can disable Fast Deployment.
Fast Deployment can be disabled in the Visual Studio project property pages or edit the project file in a text editor and set the 'EmbedAssembliesIntoApk' MSBuild property to 'true'.
Also attached msbuild.binlog.
Thanks for opening the issue and the binlog.
However we are missing the additional diagnostics produced by the _FastDeploymentDiagnosticLogging option.
Could you please provide a new one with that option enabed?
My apologies, I thought I had it enabled before that run, but may have switched branches without realizing it. Let me know if this includes the information needed. I included both the binlog file and the output to the command prompt window when running the msbuild command. Thanks!
can you try running the following command from the "Adb Command Prompt"
adb shell pm uninstall com.lathem.payclock
Note we are not using the -k option which preserves data. I just wonder if there is something from a previous installation which didn't work. Also out of interest, has this ever worked?
/* check that the data directory path is valid */if (check_data_path(info.dataDir, userAppId) <0) {
panic("Package '%s' has corrupt installation\n", pkgname);
}
@dellis1972 Thank you for pointing me in the direction of that code, next chance I have I will look through it and see if I can verify each of those checks on the device. A cursory glance looks like permissions/ownership issues, or the directory is a simlink instead of real. Does this mean that deploying without Fast Deploy does not do the same check, as it seems deploying with or without Fast Deploy shouldn't affect the directory permissions or structure. When I get a chance to look more closely I will comment back here with my findings.
Normal installaton does not use run-as. For fast deployment we have to use run-as to gain access to the internal files directory so we can place the changed assemblies there. This is what speeds up the dev process.
A normal install the assemblies are packaged in the apk so it never hits this "path". But it does reduce development times since the apk has to be built and installed each time. With Fast dev we can just send the changed dll`s over and not touch the apk.
@dellis1972 Ok, so since it doesn't use this directory when Fast Deployment is off, then it wouldn't run this check. Looking through the code I am leaning towards it being a permissions/ownership type issue. But have not quite figured out how to verify that.
We suspect this issue is stale and no longer relevant. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will undo this process.
This issue will now be closed since it had been marked "possibly-stale" but received no further activity in the past 14 days. It is still possible to reopen or comment on the issue, but please note that the issue will be locked if it remains inactive for another 30 days.
Activity
dellis1972 commentedon Feb 22, 2023
@jlinker7
Thanks for opening the issue and the binlog.
However we are missing the additional diagnostics produced by the
_FastDeploymentDiagnosticLoggingoption.Could you please provide a new one with that option enabed?
jlinker7 commentedon Feb 22, 2023
msbuildoutput_and_binlog.zip
My apologies, I thought I had it enabled before that run, but may have switched branches without realizing it. Let me know if this includes the information needed. I included both the binlog file and the output to the command prompt window when running the msbuild command. Thanks!
dellis1972 commentedon Feb 22, 2023
@jlinker7
can you try running the following command from the "Adb Command Prompt"
Note we are not using the
-koption which preserves data. I just wonder if there is something from a previous installation which didn't work. Also out of interest, has this ever worked?12 remaining items
dellis1972 commentedon Mar 10, 2023
Looking back though the old source code we find this
https://github.com/aosp-mirror/platform_system_core/blob/nougat-mr1-release/run-as/run-as.c#L176
Which leads us to https://github.com/aosp-mirror/platform_system_core/blob/nougat-mr1-release/run-as/package.c#L217.
Which suggests there is something wrong with the data directory
jlinker7 commentedon Mar 10, 2023
@dellis1972 Thank you for pointing me in the direction of that code, next chance I have I will look through it and see if I can verify each of those checks on the device. A cursory glance looks like permissions/ownership issues, or the directory is a simlink instead of real. Does this mean that deploying without Fast Deploy does not do the same check, as it seems deploying with or without Fast Deploy shouldn't affect the directory permissions or structure. When I get a chance to look more closely I will comment back here with my findings.
dellis1972 commentedon Mar 10, 2023
@jlinker7
Normal installaton does not use run-as. For fast deployment we have to use
run-asto gain access to the internalfilesdirectory so we can place the changed assemblies there. This is what speeds up the dev process.A normal install the assemblies are packaged in the apk so it never hits this "path". But it does reduce development times since the apk has to be built and installed each time. With Fast dev we can just send the changed dll`s over and not touch the apk.
jlinker7 commentedon Mar 10, 2023
@dellis1972 Ok, so since it doesn't use this directory when Fast Deployment is off, then it wouldn't run this check. Looking through the code I am leaning towards it being a permissions/ownership type issue. But have not quite figured out how to verify that.
[FastDeploy] Retry first run-as query to absorb post-install data-dir…
[FastDeploy] Verify install with 'pm path' and diagnose disk space (#…
dotnet-policy-service commentedon Aug 13, 2026
We suspect this issue is stale and no longer relevant. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will undo this process.
dotnet-policy-service commentedon Aug 27, 2026
This issue will now be closed since it had been marked "possibly-stale" but received no further activity in the past 14 days. It is still possible to reopen or comment on the issue, but please note that the issue will be locked if it remains inactive for another 30 days.