# Why unity crashes when using shell32 in unity3d?

I'm using shell 32 to get some file descriptions. It works perfect in Visual Studio 2010, but when it comes inside unity3d it crashes.

The code is:

using Shell32;

ShellClass shell = new ShellClass();
Folder objFolder = shell.NameSpace(path);

string fileTitle = objFolder.GetDetailsOf(objFolder.Items().item(0),21); //Crash on this line


• Sorry about the tags, I couldn't add more, but they are actually, "Shell32", "Crash", "Error" – Kourosh Sep 22 '11 at 7:39
• Do you have to use Shell32? It won't of course work on Mac, iOS, Android, or the WebPlayer. – Warwick Allison Sep 22 '11 at 9:53
• What is column 21? – Warwick Allison Sep 22 '11 at 9:56
• I'm writing a plugin, it won't need to be there for compile. just using inside the editor... 21 will return the title – Kourosh Sep 22 '11 at 10:35
• Try using System.Diagnosics.FileVersionInfo (msdn.microsoft.com/en-us/library/91sft6af.aspx) – Nevermind Sep 22 '11 at 12:45

Using Shell32 isn't portable.

Have you tried using the .net equivalents?

http://msdn.microsoft.com/en-us/library/system.io.filesysteminfo.aspx

• Thanks Tetrad, I looked into it. It won't give access to details tab. – Kourosh Sep 22 '11 at 16:12

Yes, use the System.IO; namespace

there you have multiple interesting methods like

File.Exists(...) Directory.Exists( ...) Path.GetDirectoryName(...) Path.Combine(path, filename) Path.GetFileNameOnly(...)

( note: the method I wrote are not exactly correctly named, but you get the picture) :)

Cheers T.