【发布时间】:2013-01-16 20:31:39
【问题描述】:
来自这个问题:
C#, Localization, Resources, and MonoDevelop
在答案部分它说:
“通常的做法是将你的资源以 .resx 形式存储在项目中,MonoDevelop 在构建项目时会自动将它们编译成 .resources 文件(你必须手动编译 .txt 文件)。不幸的是 MD 没有resx 文件的特殊编辑工具,因此您必须直接编辑 XML。"
我有一个可以在带有 vs2008 的 Windows 上运行的应用程序。
我正在尝试将其移植到 Mac OSX。
我有一个包含不同字符串的 .resx 文件。
当我使用时:
Resources.Properties.Resources.Distributor_ARDL
我明白了:
{System.Reflection.TargetInvocationException:调用的目标已引发异常。 ---> System.OverflowException:数字溢出。在(包装器托管到本机)对象:__icall_wrapper_mono_array_new_specific(intptr,int)在 System.Drawing.Icon.InitFromStreamWithSize(System.IO.Stream 流,Int32 宽度,Int32 高度)[0x00000] 在 System.Drawing:0。 Icon..ctor (System.Runtime.Serialization.SerializationInfo info, StreamingContext context) [0x00000] in :0 at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[ ],System.Exception&) 在 System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] 参数, System.Globalization.CultureInfo 文化) [0x00000] in :0 --- 内部异常堆栈跟踪结束 --- 在 System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] 参数, System.Globalization.CultureInfo 文化) [0x00000] in :0 在 System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] 参数)[0x00000] 在 System.Runtime.Serialization.ObjectRecord.LoadData 的 0 处(System.Runtime.Serialization.ObjectManager 管理器,ISurrogateSelector 选择器,StreamingContext 上下文)[0x00000] 在 System.Runtime 的 0 处。 Serialization.ObjectManager.DoFixups () [0x00000] 在 System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadNextObject (System.IO.BinaryReader reader) [0x00000] 在 System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadNextObject [0x00000] [0x00000] 在 System.Runtime.Serialization.Formatters:0。 Binary.ObjectReader.ReadObjectGraph (BinaryElement elem, System.IO.BinaryReader reader, Boolean readHeaders, System.Object& result, System.Runtime.Remoting.Messaging.Header[]& headers) [0x00000] in :0 at System.Runtime.Serialization .Formatters.Binary.BinaryFormatter.NoCheckDeserialize (System.IO.Stream serializationStream, System.Runtime.Remoting.Messaging.HeaderHandler 处理程序) [0x00000] 在 System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize (System. IO.Stream 序列化Stream) [ 0x00000] 在 System.Resources.ResourceReader.ReadNonPredefinedValue (System.Type exp_type) [0x00000] 在 System.Resources.ResourceReader.ReadValueVer2 (Int32 type_index) [0x00000] 在 System.Resources.ResourceReader 在 0x00000 中。 LoadResourceValues (.ResourceCacheItem[] store) [0x00000] in :0 at System.Resources.ResourceReader+ResourceEnumerator.FillCache () [0x00000] in :0 at System.Resources.ResourceReader+ResourceEnumerator..ctor (System.Resources.ResourceReader readerToEnumerate ) [0x00000] in :0 在 System.Resources.ResourceReader.GetEnumerator () [0x00000] in:0 在 System.Resources.ResourceSet.ReadResources () [0x00000] 在:0 在 System.Resources.ResourceSet.GetObjectInternal (System.Resources.ResourceSet.GetObjectInternal) String name, Boolean ignoreCase) [0x00000] in :0 at System.Resources.ResourceSet.GetObject (System.String name, Boolean ignoreCase) [0x00000] in :0 at System.Resources.RuntimeResourceSet.GetObject (System.String name, Boolean ignoreCase) [0x00000] in :0 在 System.Resour ces.ResourceSet.GetStringInternal (System.String name, Boolean ignoreCase) [0x00000] in :0 at System.Resources.ResourceSet.GetString (System.String name, Boolean ignoreCase) [0x00000] in :0 at System.Resources.ResourceManager。 GetString (System.String name, System.Globalization.CultureInfoculture) [0x00000] in :0 at Imaginality.Resources.Properties.Resources.get_Distributor_ARDL () [0x00000] in
所以我想知道 resx 文件是否正常工作。
如果其他人在这个问题上遇到过任何运气。
resx 的构建选项设置为 embeddedresouce。
【问题讨论】:
-
这看起来像是某个地方的错误。你可以在这里归档吗:bugzilla.xamarin.com?记得添加一个完整的测试项目。
标签: macos resources mono monodevelop resx