Bug 34176 - Environment.GetFolderPath(Environment.SpecialFolder.Personal) reports incorrect folder on El Capitan with iOS simulator.
Summary: Environment.GetFolderPath(Environment.SpecialFolder.Personal) reports incorre...
Status: RESOLVED ANSWERED
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: XI 9.0 (iOS9)
Hardware: PC Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-09-22 14:15 UTC by Mark Smith
Modified: 2015-12-04 15:02 UTC (History)
5 users (show)

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

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 ANSWERED

Description Mark Smith 2015-09-22 14:15:29 UTC
I'm using the Environment.GFP API to get to the Documents folder on iOS.

On El Capitan, with the iOS Simulator the folder returned is actually the root AppBundle folder, not the Documents folder. This means code all fails because it’s not the correct folder. The workaround is to use the native NSFolder APIs to get the documents folder.

This will hit anyone who has installed El Capitan (RTM) and wants to use the iOS simulator. Physical devices are not impacted (so it’s not an iOS9 issue). 

System details:
=== Xamarin Studio ===

Version 5.9.7 (build 9)
Installation UUID: 50562e10-5ff9-448f-b0e4-17ca662d9b75
Runtime:
	Mono 4.0.4 ((detached/cb6d6b2)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400040002

=== Apple Developer Tools ===

Xcode 7.0 (8227)
Build 7A220

=== Xamarin.iOS ===

Version: 9.0.1.20 (Business Edition)
Hash: d8e9592
Branch: master
Build date: 2015-09-18 23:22:05-0400

=== Xamarin.Android ===

Version: 5.1.6.7 (Business Edition)
Android SDK: /Users/mark/Android/sdk
	Supported Android versions:
		2.3    (API level 10)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
		5.1    (API level 22)
Java SDK: /usr
java version "1.7.0_75"
Java(TM) SE Runtime Environment (build 1.7.0_75-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.75-b04, mixed mode)

=== Xamarin Android Player ===

Version: Unknown version
Location: /Applications/Xamarin Android Player.app

=== Xamarin.Mac ===

Version: 2.0.2.111 (Business Edition)

=== Build Information ===

Release ID: 509070009
Git revision: 31fa64709030b3edb971237780a452a4c69943c4
Build date: 2015-09-17 11:44:37-04
Xamarin addins: b105d33d8cd72911ff2cf3ee0b7715d37e5f19a6

=== Operating System ===

Mac OS X 10.11.1
Darwin Marks-MBP.local 15.0.0 Darwin Kernel Version 15.0.0
    Tue Sep 15 12:43:52 PDT 2015
    root:xnu-3247.10.9~3/RELEASE_X86_64 x86_64
Comment 1 Sandy Armstrong [MSFT] 2015-10-09 14:42:07 UTC
I am seeing this same bug (with SpecialFolder.MyDocuments as well as SpecialFolder.Personal) on Yosemite.


Xamarin Studio
Version 5.10 (build 811)
Installation UUID: c8e0a9c3-4244-40de-9072-735d18850e7f
Runtime:
	Mono 4.2.1 (explicit/804ddbc)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 402010060

Xamarin.Profiler
Not Installed

Xamarin.Android
Version: 6.0.0.8 (Business Edition)
Android SDK: /Users/sandy/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.3   (API level 10)
		4.0.3 (API level 15)
		4.2   (API level 17)
		4.4   (API level 19)
		5.0   (API level 21)

SDK Tools Version: 23.0.5
SDK Platform Tools Version: 21
SDK Build Tools Version: 20.0.0

Java SDK: /usr
java version "1.8.0_20"
Java(TM) SE Runtime Environment (build 1.8.0_20-b26)
Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode)

Xamarin Android Player
Version: 0.6.2
Location: /Applications/Xamarin Android Player.app

Apple Developer Tools
Xcode 7.0 (8227)
Build 7A220

Xamarin.Mac
Version: 2.4.0.79 (Business Edition)

Xamarin.iOS
Version: 9.2.0.84 (Business Edition)
Hash: b5396c2
Branch: master
Build date: 2015-09-30 15:22:15-0400

Build Information
Release ID: 510000811
Git revision: 34cd31ea72536afab530c14d9220b286075e83cd
Build date: 2015-09-30 10:40:37-04
Xamarin addins: 8e6fccfc0c19a7e0b7b11be925f09751d827eb5c
Build lane: monodevelop-lion-cycle6

Operating System
Mac OS X 10.10.5
Darwin Sandys-MacBook-Pro.local 14.5.0 Darwin Kernel Version 14.5.0
    Wed Jul 29 02:26:53 PDT 2015
    root:xnu-2782.40.9~1/RELEASE_X86_64 x86_64
Comment 2 Sandy Armstrong [MSFT] 2015-10-09 15:33:29 UTC
Switched back to stable: path was correct
Switched back to alpha: path was still correct (?!)
Rebooted, loaded another app that had been giving me problems: path was wrong (as described in bug)
Deleted app from simulator, rebuilt, redeployed: path was correct

If I can reproduce this better I'll update the bug.
Comment 4 Sebastien Pouliot 2015-10-15 10:58:49 UTC
We're already using Apple API to return the document folder so that should be working on 10.11.

@Gouri can someone from QA (running 10.11) confirms this ?
Comment 5 GouriKumari 2015-10-15 14:03:03 UTC
>>@Gouri can someone from QA (running 10.11) confirm this ?

I tested with current stable from an ElCapitan and Yosemite machine.  In both cases, (Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments)) returned :

ElCapitan:
 /Users/gouri/Library/Developer/CoreSimulator/Devices/5F9D77ED-5FC2-459D-8E3D-2BB7F626C88A/data/Containers/Data/Application/B9566FD2-A790-479A-93B3-034C1813AFE0/Documents

Yosemite:
/Users/gourikumari/Library/Developer/CoreSimulator/Devices/C6377FDC-BE3E-4736-875D-D47A3A0A46BA/data/Containers/Data/Application/6B689EA5-9ABD-4B9F-962D-6BC39B0169F1/Documents

Test Env :(ElCapitan)
=== Xamarin Studio ===

Version 5.9.7 (build 22)
Installation UUID: fafd3486-1aec-4f9c-ab77-08bf4a000708
Runtime:
	Mono 4.0.4 ((detached/d481017)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400040004

=== Apple Developer Tools ===

Xcode 7.0.1 (8228)
Build 7A1001

=== Xamarin.iOS ===

Version: 9.0.1.29 (Business Edition)
Hash: 1d27ac2
Branch: master
Build date: 2015-09-25 18:08:44-0400

=== Xamarin.Android ===

Version: 5.1.7.12 (Business Edition)
Android SDK: /Users/gouri/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		4.0.3 (API level 15)
		4.4   (API level 19)
		5.0   (API level 21)
Java SDK: /usr
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

=== Xamarin Android Player ===

Not Installed

=== Xamarin.Mac ===

Version: 2.0.2.111 (Business Edition)

=== Build Information ===

Release ID: 509070022
Git revision: 6bd1f169df44ca96addf8a035316c535a4fa46fa
Build date: 2015-09-30 12:30:15-04
Xamarin addins: 1c3e5c0859bdfec0ecd481a57ad6c03bc22f5536

=== Operating System ===

Mac OS X 10.11.0
----------------------------
Test Env(Yosemite):

=== Xamarin Studio ===

Version 5.9.7 (build 22)
Installation UUID: 5ed3a124-4b77-4c6f-beb9-c830fd815e2a
Runtime:
	Mono 4.0.4 ((detached/d481017)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400040004

=== Xamarin.Android ===

Version: 5.1.7.12 (Enterprise Edition)
Android SDK: /Users/gourikumari/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		2.3   (API level 10)
		4.0.3 (API level 15)
		4.4   (API level 19)
Java SDK: /usr
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

=== Xamarin Android Player ===

Not Installed

=== Apple Developer Tools ===

Xcode 7.0 (8227)
Build 7A220

=== Xamarin.iOS ===

Version: 9.0.1.29 (Enterprise Edition)
Hash: 1d27ac2
Branch: master
Build date: 2015-09-25 18:08:44-0400

=== Xamarin.Mac ===

Version: 2.0.2.111 (Enterprise Edition)

=== Build Information ===

Release ID: 509070022
Git revision: 6bd1f169df44ca96addf8a035316c535a4fa46fa
Build date: 2015-09-30 12:30:15-04
Xamarin addins: 1c3e5c0859bdfec0ecd481a57ad6c03bc22f5536

=== Operating System ===

Mac OS X 10.10.5
Comment 6 Mark Smith 2015-10-15 14:04:36 UTC
It's likely that the actual cause of my issue is the Inspector plug-in for Xamarin Studio. @sandy has found that the replaced Xamarin.iOS.dll used at runtime has this issue, so it was not El Capitan, it was the inspector.
Comment 8 canab 2015-12-04 08:43:34 UTC
I can confirm that Xamarin Inspector causes the issue.

Xamarin Studio
Version 5.10.1 (build 3)
Installation UUID: 12888312-f7f9-4276-91ec-fae91acc8cd1
Runtime:
	Mono 4.2.1 (explicit/6dd2d0d)
	GTK+ 2.24.23 (Raleigh theme)
Comment 9 Sandy Armstrong [MSFT] 2015-12-04 14:29:25 UTC
canab, what version of the Inspector are you using? This should have been fixed before the first public release.

Also what version of Xamarin.iOS do you have installed?
Comment 10 canab 2015-12-04 14:37:20 UTC
Xamarin.iOS
Version: 9.1.0.27 (Business Edition)

Xamarin Inspector
0.3.2.3

I am temporary not able to get the last version of Xamarin.iOS.
My be it is a reason too.
Comment 11 Sebastien Pouliot 2015-12-04 15:02:07 UTC
That's the reason, you need XI 9.2.1.50+ [1] to have the REPL fix.

[1] https://developer.xamarin.com/releases/ios/xamarin.ios_9/xamarin.ios_9.2/