Bug 55520 - File.Move of filenames with special characters in filename does not work
Summary: File.Move of filenames with special characters in filename does not work
Alias: None
Product: iOS
Classification: Xamarin
Component: Mono runtime / AOT compiler ()
Version: XI 10.8 (d15-1)
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: Future Cycle (TBD)
Assignee: Zoltan Varga
Depends on:
Reported: 2017-04-24 14:33 UTC by gaoyuan_chen
Modified: 2017-09-22 20:26 UTC (History)
7 users (show)

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 for Bug 55520 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description gaoyuan_chen 2017-04-24 14:33:39 UTC
Using System.IO's File.Move of filenames with special characters in other languages causes file to be hidden.  For example, changing a filename from test.m4a to "Ö.m4a" causes the file to "disappear" in the file system.   Issue in other languages other than Japanese also exists. Trying to read the file via NSUrl or AVAudioplayer does not work.  Downloading the app container and inspecting the container contents does not show the file exists.

Using System.IO's Directory.GetFiles(...) will return the file as an existing file.  Attached is a sample app that reproduces the issue.  I was unable to reproduce this issue using a native iOS app written in Objective-C.

=== Xamarin Studio Enterprise ===

Version 6.3 (build 863)
Installation UUID: 62529d90-ec50-44f6-b4ba-33ac477e80fd
	Mono 4.8.1 (mono-4.8.0-branch/22a39d7) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 408010000

=== NuGet ===


=== Xamarin.Profiler ===

Version: 1.4.0
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Apple Developer Tools ===

Xcode 8.3.2 (12175)
Build 8E2002

=== Xamarin.Mac ===

Version: (Visual Studio Enterprise)

=== Xamarin Inspector ===

Version: 1.2.2
Hash: b71b035
Branch: d15-1
Build date: Fri, 21 Apr 2017 17:57:12 GMT

=== Xamarin.Android ===

Version: (Visual Studio Enterprise)
Android SDK: /Users/cheng/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		6.0 (API level 23)

SDK Tools Version: 25.1.2
SDK Platform Tools Version: 24.0.0
SDK Build Tools Version: 23.0.2

Java SDK: /usr
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

Android Designer EPL code available here:

=== Xamarin.iOS ===

Version: (Visual Studio Enterprise)
Hash: a04678c2
Branch: d15-1
Build date: 2017-03-28 14:05:38-0400

=== Build Information ===

Release ID: 603000863
Git revision: a2163670efe259c85cd8f335d95b175068fbbe2a
Build date: 2017-04-03 14:33:15-04
Xamarin addins: 2045d688ea1420e0381b473360ca62a763eb7d04
Build lane: monodevelop-lion-d15-1

=== Operating System ===

Mac OS X 10.12.4
Darwin hqchengaoymacbook.ms.starkey.com 16.5.0 Darwin Kernel Version 16.5.0
    Fri Mar  3 16:52:33 PST 2017
    root:xnu-3789.51.2~3/RELEASE_X86_64 x86_64
Comment 1 Alex Soto [MSFT] 2017-04-24 15:57:18 UTC
Hello, thanks for contacting us!

> Attached is a sample app that reproduces the issue

It seems the attachment did not make it, would you be able to provide said test case to us?
Comment 2 gaoyuan_chen 2017-04-24 16:16:57 UTC
Hi, thanks for replying. It seems like I could not attach again so I have copied the viewcontroller.cs code in here.

using AVFoundation;
using System;
using System.IO;
using UIKit;
using Foundation;
namespace XamarinAVAudioTest.iOS
	public partial class ViewController : UIViewController
		AVAudioPlayer _libraryAudioPlayer;
		int count = 1;

		public ViewController(IntPtr handle) : base(handle)

		public override void ViewDidLoad()

			// Perform any additional setup after loading the view, typically from a nib.
			Button.AccessibilityIdentifier = "myButton";
			Button.TouchUpInside += delegate
				var title = string.Format("{0} clicks!", count++);
				Button.SetTitle(title, UIControlState.Normal);

			//testButton.TouchUpInside += TestButton_TouchUpInside;

		partial void buttonClick(Foundation.NSObject sender)
			//TODO: change name and play audio here;
			string filename = "test";
			var sourcePath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
			string source = Path.Combine(sourcePath, filename) + ".m4a";
			//1) change the filename into "Ö.m4a"
			string changeName = "Ö";
			var destinationPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
			string destination = Path.Combine(destinationPath, changeName) + ".m4a";
			//2) Move "Ö.m4a" into other directory
			if (File.Exists (destination)) {
				File.Delete (destination);

			File.Move(source, destination);
			//3) Transform string path into url
			NSUrl url = NSUrl.FromString(destination);
			//4) Play audio w/ AVAudio
			_libraryAudioPlayer = AVAudioPlayer.FromUrl(url);

		public override void DidReceiveMemoryWarning()
			// Release any cached data, images, etc that aren't in use.		

		//void TestButton_TouchUpInside(object sender, EventArgs e)
		//	//TODO: 
Comment 3 gaoyuan_chen 2017-04-25 13:26:47 UTC
Also, this bug only exists in iOS 10.3 and worked as expected back in version 10.2
Comment 4 Rolf Bjarne Kvinge [MSFT] 2017-04-25 13:54:42 UTC
This might be related to Apple changing the file system to APFS: https://mjtsai.com/blog/2017/03/24/apfss-bag-of-bytes-filenames/
Comment 5 gaoyuan_chen 2017-04-25 14:38:11 UTC
The blog post recommends using NSFileManager.  Is there an ETA on when File.Move will be updated to be compatible with APFS+?
Comment 6 gaoyuan_chen 2017-04-25 17:31:37 UTC
Thanks for your help! I've solved that problem by replacing File.Move to NSFileManager move methods and it works well!
Comment 7 Alex Soto [MSFT] 2017-04-26 15:51:26 UTC
@Kumpera and @Marek FYI, also Apple could turn this on for macOS at some point and cause more issues in the long run.
Comment 8 Manuel de la Peña [MSFT] 2017-06-05 16:06:21 UTC
Adding Ludovic in the loop regarding this.
Comment 9 Vincent Dondain [MSFT] 2017-07-16 23:13:07 UTC
Marking this bug as CONFIRMED. The milestone is set to TBD which is ok since there's a workaround (NSFileManager).

Guess it's fair to keep this bug around until File.Move is working on 10.13.