0

在 Windows 7 重新启动后,我突然在 Visual Studio 中遇到了一个 Unicode 问题。有谁知道如何解决这个问题?在过去的几个小时里,我一直在搞乱病毒扫描程序和 .cspoj 文件(错误所在的位置),但无济于事。

Error   1   The build stopped unexpectedly because of an internal failure.
System.Text.EncoderFallbackException: Unable to translate Unicode character \uD97C at index 1321 to specified code page.
   at System.Text.EncoderExceptionFallbackBuffer.Fallback(Char charUnknown, Int32 index)
   at System.Text.EncoderFallbackBuffer.InternalFallback(Char ch, Char*& chars)
   at System.Text.UTF8Encoding.GetByteCount(Char* chars, Int32 count, EncoderNLS baseEncoder)
   at System.Text.UTF8Encoding.GetByteCount(String chars)
   at System.IO.BinaryWriter.Write(String value)
   at Microsoft.Build.BackEnd.NodePacketTranslator.NodePacketWriteTranslator.TranslateDictionary(Dictionary`2& dictionary, IEqualityComparer`1 comparer)
   at Microsoft.Build.Execution.BuildParameters.Microsoft.Build.BackEnd.INodePacketTranslatable.Translate(INodePacketTranslator translator)
   at Microsoft.Build.BackEnd.NodePacketTranslator.NodePacketWriteTranslator.Translate[T](T& value, NodePacketValueFactory`1 factory)
   at Microsoft.Build.BackEnd.NodeConfiguration.Translate(INodePacketTranslator translator)
   at Microsoft.Build.BackEnd.NodeProviderOutOfProcBase.NodeContext.SendData(INodePacket packet)
   at Microsoft.Build.BackEnd.NodeProviderOutOfProc.CreateNode(Int32 nodeId, INodePacketFactory factory, NodeConfiguration configuration)
   at Microsoft.Build.BackEnd.NodeManager.AttemptCreateNode(INodeProvider nodeProvider, NodeConfiguration nodeConfiguration)
   at Microsoft.Build.BackEnd.NodeManager.CreateNode(NodeConfiguration configuration, NodeAffinity nodeAffinity)
   at Microsoft.Build.Execution.BuildManager.PerformSchedulingActions(IEnumerable`1 responses)
   at Microsoft.Build.Execution.BuildManager.HandleNewRequest(Int32 node, BuildRequestBlocker blocker)
   at Microsoft.Build.Execution.BuildManager.IssueRequestToScheduler(BuildSubmission submission, Boolean allowMainThreadBuild, BuildRequestBlocker blocker) 

答案是:

http://www.hanselman.com/blog/CSIVisualStudioUnableToTranslateUnicodeCharacterAtIndexXToSpecifiedCodePage.aspx

注意。汉斯是最接近弄清楚发生了什么事的人……所以我把积分给了他

4

1 回答 1

2

嗯,消息很准确。\uD97C 一个 utf-16 代理项,代理项必须始终成对出现以对值大于 \uFFFF 的字符进行编码。异常消息表明该对的第二个代理项没有出现在字符串中。

在构建中看到这种情况是非常坏的消息,这样的字符不应该出现在项目文件中。您不会用一种古老的死去的中东语言或一种晦涩的美国本土语言来写它们,而有几千人仍然知道如何说它:)。唯一合理的解释是你磁盘上的文件被打乱了。你需要修好你的机器,更换磁盘应该是你现在优先考虑的事情。

于 2013-06-05T13:39:55.447 回答