- Home /
trying to parse FileNotFoundException causes compile error
Hello,
So I am trying to catch a FileNotFoundException and read the file from the exception like this:
catch (FileNotFoundException e)
{
string file = e.FileName;
}
Visual Studio throws no errors, but in unity at compile time it throws:
Type `System.IO.FileNotFoundException' does not contain a definition for `FileName' and no extension method `FileName' of type `System.IO.FileNotFoundException' could be found (are you missing a using directive or an assembly reference?)
any idea why it would do this?
Interesting. Have you done anything to your visual studio project? Only thing I can guess is that unity and visual studio aren't using the same .net framework.
I don't think I have done anything to the VS project, I re-synced it just to make sure. VS is referenced to System.Core V3.5 and System V2. I am using a custom compiled version of the 4.6 UI, could that have something to do with it?
Oh in that case then it makes sense your compiled version has a different idea of what .net is than your environment.
Did you compile it yourself? If not then that's a good place to start.
yea, so I forked and cloned the ui repos. and just did some $$anonymous$$or changes, it is using the same version core and system.
Something must be wrong with your solution. I'd bring this issue to whoever's repo you forked or the forums.
Your answer
Follow this Question
Related Questions
i won't Use path relative to the project folder. 0 Answers
Permission re-activate error mac 2 Answers
Moving File Failed error [Solved] 2 Answers
HELP! Erorr! 3 Answers
Access is denied in Windows 8 App 0 Answers