Bug 12306 - Missing Properties of NSString class - PathExtension, PathComponents ?
Summary: Missing Properties of NSString class - PathExtension, PathComponents ?
Status: RESOLVED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: 6.2.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Sebastien Pouliot
URL:
Depends on:
Blocks:
 
Reported: 2013-05-20 13:36 UTC by Joseph Remes
Modified: 2013-05-21 11:06 UTC (History)
2 users (show)

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


Attachments
Complete solution that illustrates problem with NSString (4.21 KB, application/zip)
2013-05-21 10:00 UTC, Joseph Remes
Details
The monotouch.dll file referenced before. (4.52 MB, application/octet-stream)
2013-05-21 10:03 UTC, Joseph Remes
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 FIXED

Description Joseph Remes 2013-05-20 13:36:35 UTC
According to the MonoDoc app (version 1.0) the MonoTouch.Foundation.NSString class has a property PathExtension.
(Apple also documents this property.)
But the compiler in Xamarin Studio (4.0.8) says that it does not exist.
My version of Xamarin.iOS is 6.2.5.2

PathComponents property also documented but missing? Many others related to file path manipulation appear to be missing too.

Is this a big black hole that needs attention or am I missing something?
Comment 1 Joseph Remes 2013-05-20 13:51:20 UTC
LastPathComponent property also documented but missing.
Comment 2 Sebastien Pouliot 2013-05-21 08:12:11 UTC
Those methods (along several similars) exists. E.g.  once compiled I get, in the immediate pad:

> ? s
{/dir/file.ext}
> ? s.PathExtension
{ext}
> ? s.PathComponents
{string[3]}
> ? s.LastPathComponent
{file.ext}
 
Maybe it's a code completion issue with Xamarin Studio ? (i.e. they are not shown but code compiles ?)

It you have a compiler error please attach a test case that we can try and duplicate the same error.
Comment 3 Sebastien Pouliot 2013-05-21 08:19:06 UTC
QA: added unit tests for them in 95b3881a10b805facd888c574ab8e3c5a459e151 (master)
Comment 4 Joseph Remes 2013-05-21 09:14:50 UTC
using System;
using MonoTouch.Foundation;
using MonoTouch.UIKit;

namespace TestA
{
	public class Application
	{
		static void Main (string[] args)
		{
			NSString abc = (NSString)"/dir/file/ext";
			NSString ext = abc.LastPathComponent;
			UIApplication.Main (args, null, "AppDelegate");
		}
	}
}

/Users/jpremes/Projects/TestA/TestA/Main.cs(12,44): Error CS1061: Type `MonoTouch.Foundation.NSString' does not contain a definition for `LastPathComponent' and no extension method `LastPathComponent' of type `MonoTouch.Foundation.NSString' could be found (are you missing a using directive or an assembly reference?) (CS1061) (TestA)
/Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll (Location of the symbol related to previous error)
Comment 5 Sebastien Pouliot 2013-05-21 09:46:31 UTC
Sorry I was not clear. I need you to attach a self-contained test case because I want to look at the project files (and options) more than the source code (the same code works fine for me).

It might also prove useful to:

a) include the full build log (not just the errors) from the "Build Output" of the "Errors pad" (so I can see which compiler and options were used).

b) attach the file `/Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll`
Comment 6 Joseph Remes 2013-05-21 10:00:46 UTC
Created attachment 3998 [details]
Complete solution that illustrates problem with NSString

I'l send those other things that you requested shortly.

In the attached 'solution' I put the problem lines of code in Main.cs
Comment 7 Joseph Remes 2013-05-21 10:03:32 UTC
Created attachment 3999 [details]
The monotouch.dll file referenced before.

/Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll
Comment 8 Joseph Remes 2013-05-21 10:09:17 UTC
Is this what you meant by the complete build log?


Cleaning Solution: TestB (Debug|iPhoneSimulator)

Cleaning: TestB (Debug|iPhoneSimulator)
Removing output files...
Clean complete

Building Solution: TestB (Debug|iPhoneSimulator)

Building: TestB (Debug|iPhoneSimulator)
Performing main compilation...
/Developer/MonoTouch/usr/bin/smcs /noconfig "/out:/Users/jpremes/Projects/TestB/TestB/bin/iPhoneSimulator/Debug/TestB.exe" "/r:/Developer/MonoTouch/usr/lib/mono/2.1/System.dll" "/r:/Developer/MonoTouch/usr/lib/mono/2.1/System.Xml.dll" "/r:/Developer/MonoTouch/usr/lib/mono/2.1/System.Core.dll" "/r:/Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll" /nologo /warn:4 /debug:full /optimize- /codepage:utf8 "/define:DEBUG;__MOBILE__;__IOS__"  /t:exe "/Users/jpremes/Projects/TestB/TestB/Main.cs" "/Users/jpremes/Projects/TestB/TestB/AppDelegate.cs" 
Compilation failed: 1 error(s), 0 warnings

/Users/jpremes/Projects/TestB/TestB/Main.cs(12,44): error CS1061: Type `MonoTouch.Foundation.NSString' does not contain a definition for `LastPathComponent' and no extension method `LastPathComponent' of type `MonoTouch.Foundation.NSString' could be found (are you missing a using directive or an assembly reference?)
/Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll (Location of the symbol related to previous error)


Build complete -- 1 error, 0 warnings

---------------------- Done ----------------------

Build: 1 error, 0 warnings
Comment 9 Sebastien Pouliot 2013-05-21 10:34:00 UTC
Thanks for the extra informations. The issue is that they were "somewhat" recently added [1] and we have not released a maintenance release (just hotfix) since then. Version 6.2.6 (under testing) will have them.

The documentation was updated since it's already availble in 6.3.5 (beta channel). Sorry about the confusion.

[1] https://github.com/mono/maccore/commit/3b93b2eeb43c889e9ffcd322eb28d09d4412218f
Comment 10 Joseph Remes 2013-05-21 10:40:15 UTC
Ok then. Can you tell me when Xamarin.iOS 6.2.6.x will be part of the stable release? I see that on the beta channel you have already jumped to 6.3.x.
I'd prefer to stay away from anything but the stable channel. I've got enough problems.
Comment 11 Sebastien Pouliot 2013-05-21 11:03:26 UTC
I do not have an exact date, but it's being tested right now (i.e. it's not something planned) and will be released (to the stable channel) as soon as we're confident of it's quality.

The .NET (managed) methods from System.IO.Path [1] should provide you with almost identical functionalities and are better if you want to create cross-platform code.

Note: The beta/alpha channel always are + 0.1 (odd nunbers are for unstable releases).

[1] http://msdn.microsoft.com/en-us/library/system.io.path.aspx
Comment 12 Joseph Remes 2013-05-21 11:06:48 UTC
Aha. System.IO.Path looks like it will do what I need.
Thanks!