0

我在 Unity 4.1.5f1 和 MonoDevelop 2.8.2 中工作(即写作时的当前 Unity 设置),我在自动完成告诉我的内容和编译器告诉我的内容之间出现了奇怪的冲突。

在 Unity 窗口中,即在 Unity 框架中显示编译器消息的位置,我收到以下消息:

Assets/Scripts/Track/Serialisation/FilePath.cs(74,31): error CS0246: The type or namespace name 'InvalidDataException' could not be found. Are you missing a using directive or an assembly reference?

但是,当我将鼠标悬停在它上面时,自动完成似乎可以理解它是什么。

自动完成从字面上知道它在哪里。

此外,我发现 InvalidDataException 使用自动完成,我没有手动输入。根据微软的说法,它在那里:http: //msdn.microsoft.com/en-us/library/system.io.invaliddataexception.aspx

在你问之前,在我的文件顶部,我有正确的using陈述:

using System.IO;

我还尝试了一个完全限定的名称:

catch(System.IO.InvalidDataException ex)
{
    Debug.Log(ex.Message);

    return false;
}

但是,编译器在不同意自动完成方面更加具体:

Assets/Scripts/Track/Serialisation/FilePath.cs(74,41): error CS0234: The type or namespace name 'InvalidDataException' does not exist in the namespace 'System.IO'. Are you missing an assembly reference?

有人知道这里发生了什么吗?我觉得这对年轻球员来说一定是个陷阱,但搜索的收获很少。通常,当 IDE 执行此类操作时,我只是重新启动它,但这并没有解决问题。

4

0 回答 0