Bug 15332 - File does not exist or wrong path with Assembly.Location in Release
Summary: File does not exist or wrong path with Assembly.Location in Release
Status: RESOLVED FEATURE
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: 4.8.x
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2013-10-10 13:02 UTC by Allie Miller
Modified: 2013-10-10 13:10 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Test Project from Case #47844 (13.52 KB, application/zip)
2013-10-10 13:02 UTC, Allie Miller
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FEATURE

Description Allie Miller 2013-10-10 13:02:16 UTC
Created attachment 5115 [details]
Test Project from Case #47844

Test project for the below error is attached.

When using the Assembly.Location the reference via

Assembly currentAssembly = Assembly.GetExecutingAssembly();

then using
currentAssembly.Location property to feed a FileVersionInfo.

FileVersionInfo info = new FileVersionInfo(currentAssembly.Location), the File Version information appears in both Debug Mode. However, when set to Release mode, the following error occurs:

Linking: None, Use Shared Runtime: No, Use Fast Deployment: No
Location: 'AboutVersion.dll'
CodeBase: 'file:///AboutVersion.dll'
BaseDir:''
UriAbsolute:'/AboutVersion.dll'
Expected Version: '1.0.0.0(AssemblyInfo.cs)'
GotVersion: 'File does not exist or wrong path.' (FileVersionInfo.FileVersion)
GotVersionUri:'File does not exist or wrong path.'(FileVersionInfo.FileVersion)

Versioning Information:
Windows 8.1 Professional
Visual Studio 2012 Professional
Xamarin 4.8.03005 (3c344aeb)

Tested Target Device(s):
Google Nexus 7 (2013): Android 4.3
Medion Lifetab (P9514): Android 4.0.3
Samsung Galaxy S (GT-I9000) [rooted running CyanogenMod 10.1.3]: Android 4.2.2
Comment 2 Jonathan Pryor 2013-10-10 13:10:05 UTC
This is By Design (and documented!):

http://docs.xamarin.com/guides/android/advanced_topics/architecture#1.application-packages
>  * The application assemblies (containing IL) are stored uncompressed within 
>     the assemblies folder [within the .apk]
>     * Note: Assembly location information such as Assembly.Location and
>       Assembly.CodeBase cannot be relied upon in Release builds. They do 
>       not exist as distinct filesystem entries, and they have no usable
>       location.