-
Notifications
You must be signed in to change notification settings - Fork 564
[Xamarin.Android.Build.Tasks] Unable to locate assemblies when running certain projects in Release modes which don't have Optimize set to True #749
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
Author
|
build |
33517e8 to
61c5fe3
Compare
…g certain projects in Release modes which don't have Optimize set to True Context https://bugzilla.xamarin.com/show_bug.cgi?id=58580 Commit edabe8a reworked the build logic so that `$(Optimize)` controls the deployment of the debug or release runtimes. Input Property: || Output Property DebugSymbols | DebugType | EmbedAssembliesIntoApk | Optimize || AndroidIncludeDebugSymbols ================+============+==========================+============++=========================== True *any* True True False (Release runtime) True *any* True False True (Debug runtime) True *any* False True True (Debug runtime) True *any* False False True (Debug runtime) True *empty* True True True (Debug runtime) True *empty* True False True (Debug runtime) True *empty* False True True (Debug runtime) True *empty* False False True (Debug runtime) False - - - False (Release runtime) *empty* *any* *empty* False True (Debug runtime) In the senario in the bug `$(DebugSymols)` `$(EmbedAssembliesIntoApk)` are both empty. As a result `$(EmbedAssembliesIntoApk)` gets a default value of 'False'. But because `$(DebugSymols)` is empty we fall through the MSBuild case statement and end up with `$(AndroidIncludeDebugSymbols)` = `True`. Which is NOT what we want in this case. So if `$(EmbedAssembliesIntoApk)` we should always default `$(AndroidIncludeDebugSymbols)` to false. In addition there was a weird issue with the way we install debug apps. If the app is using the Shared Runtime the deployment process sends a broadcast to the Shared Runtime app which returns the external storage directory. This tends to be something like /mnt/shell/emulated/0/ So when we deploy our debug assemblies we do so to a directory like /mnt/shell/emulated/0/Android/data/$(PackageName)/files/.__override__ This works as expected. Now if we try to debug an app without using the Shared Runtime it will work as expected.. unless the Shared Runtime was not installed. In this case the broadcast fails and we fall back to getting the external storage using adb shell echo -b ${EXTERNAL_STORAGE} This returns /mnt/shell/emulated/legacy so we end up deploying the debug assemblies to /mnt/shell/emulated/legacy/Android/data/$(PackageName)/files/.__override__ So all is well and good. However problems start in our runtime and the MonoPackageManager. We use android.os.Environment.getExternalStorageDirectory (); to get the external storage directory. In this case it ALWAYS returns /mnt/shell/emulated/0/ So if we are debugging without the Shared Runtime being installed, we will NEVER find the fast deployed assebmies. So the app will crash. The fix in this case is to check both directories when we are running the debug runtime.
Contributor
Author
|
build |
jonpryor
pushed a commit
to jonpryor/xamarin-android
that referenced
this pull request
Sep 11, 2017
dotnet#749) Context: https://bugzilla.xamarin.com/show_bug.cgi?id=58580 Unable to locate assemblies when running projects when `$(Configuration)`=Release and `$(Optimize)` != True. Commit edabe8a reworked the build logic so that `$(Optimize)` controls the deployment of the debug or release runtimes. Input Property: || Output Property DebugSymbols | DebugType | EmbedAssembliesIntoApk | Optimize || AndroidIncludeDebugSymbols ================+============+==========================+============++=========================== True *any* True True False (Release runtime) True *any* True False True (Debug runtime) True *any* False True True (Debug runtime) True *any* False False True (Debug runtime) True *empty* True True True (Debug runtime) True *empty* True False True (Debug runtime) True *empty* False True True (Debug runtime) True *empty* False False True (Debug runtime) False - - - False (Release runtime) *empty* *any* *empty* False True (Debug runtime) In this scenario, `$(DebugSymols)` and `$(EmbedAssembliesIntoApk)` are both empty. As a result `$(EmbedAssembliesIntoApk)` gets a default value of 'False'. But because `$(DebugSymols)` is empty we fall through the MSBuild case statement and end up with `$(AndroidIncludeDebugSymbols)` = `True`. Which is NOT what we want in this case. So if `$(EmbedAssembliesIntoApk)` we should always default `$(AndroidIncludeDebugSymbols)` to false. In addition there was a weird issue with the way we install debug apps. If the app is using the Shared Runtime the deployment process sends a broadcast to the Shared Runtime app which returns the external storage directory. This tends to be something like /mnt/shell/emulated/0/ So when we deploy our debug assemblies we do so to a directory like /mnt/shell/emulated/0/Android/data/$(PackageName)/files/.__override__ This works as expected. Now if we try to debug an app without using the Shared Runtime it will work as expected.. unless the Shared Runtime was not installed. In this case the broadcast fails and we fall back to getting the external storage using adb shell echo -b ${EXTERNAL_STORAGE} This returns /mnt/shell/emulated/legacy so we end up deploying the debug assemblies to /mnt/shell/emulated/legacy/Android/data/$(PackageName)/files/.__override__ So all is well and good. However problems start in our runtime and the MonoPackageManager. We use android.os.Environment.getExternalStorageDirectory (); to get the external storage directory. In this case it ALWAYS returns /mnt/shell/emulated/0/ So if we are debugging without the Shared Runtime being installed, we will NEVER find the fast deployed assebmies. So the app will crash. The fix in this case is to check both directories when we are running the debug runtime.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context https://bugzilla.xamarin.com/show_bug.cgi?id=58580
Commit edabe8a reworked the build logic so that
$(Optimize)controls the deployment of the debug or release runtimes.
In the senario in the bug
$(DebugSymols)$(EmbedAssembliesIntoApk)are both empty.As a result
$(EmbedAssembliesIntoApk)gets a default value of 'False'.But because
$(DebugSymols)is empty we fall through the MSBuild case statementand end up with
$(AndroidIncludeDebugSymbols)=True. Which is NOT what we want in this case.So if
$(EmbedAssembliesIntoApk)we should always default$(AndroidIncludeDebugSymbols)to false.
In addition there was a weird issue with the way we install debug apps.
If the app is using the Shared Runtime the deployment process sends a
broadcast to the Shared Runtime app which returns the external storage
directory. This tends to be something like
So when we deploy our debug assemblies we do so to a directory like
This works as expected. Now if we try to debug an app without using the Shared
Runtime it will work as expected.. unless the Shared Runtime was not installed.
In this case the broadcast fails and we fall back to getting the external storage
using
This returns
so we end up deploying the debug assemblies to
So all is well and good. However problems start in our runtime and the
MonoPackageManager. We use
to get the external storage directory. In this case it ALWAYS returns
So if we are debugging without the Shared Runtime being installed, we will
NEVER find the fast deployed assebmies. So the app will crash. The fix in
this case is to check both directories when we are running the debug
runtime.