Closed dlgreenwell closed 6 years ago
According to the protobuf readme...
supported:
custom classes that: are marked as data-contract have a parameterless constructor for Silverlight: are public
Silverlight classes have to be public or else the Reflection that they are using will not work. I pulled the repo and made the change and it works in my case.
Is there a reason the TimeZoneData or CldrLanguageData classes need to be internal? If so I can just keep updating my end when there is a new published package but I could also make a PR for it if you would like.
Just released 3.0.0 for .NET Standard support and removal of protobuf. Thus, this is no longer applicable. Thanks.
While trying to use the TimeZoneNames library in Silverlight everything worked well while I was on localhost(elevated trust), but when i switched to a different machine or hitting my own box not on localhost I got the following error.
An unhandled exception 'Unhandled Error in Silverlight Application Code:4004 Category: ManagedRuntimeError Message: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation System.TypeInitializationException:The type initialize for 'TimeZoneNames.TZNames' threw an exceptionSystem.MethodAccessException: Attempt by method 'ProtoBuf.Serializers.TypeSerializer.Createinstance(ProtoBuf.ProtoReader, Boolean)' to access method 'TimeZoneNames.TimeZoneData.ctor()' failed. at System.RumtimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, BooleanskipCheckThis, Boolean fillCache) at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache) at ProtoBuf.Serializers.TypeSerializer.Read(Object value, ProtoReader source) at ProtoBuf.Meta.Runtime.TypeModel.Deserialize(Int32 key, Object value, ProtoReader source) at ProtoBuf.Meta.TypeModel.DeserializeCore(ProtoReader reader, Type type, Object alue, Boolean noAutoCreate at ProtoBuf.Meta.TypeModel.Deserialize(Stream source, Object value, Type type, SerializationContext context) at ProtoBuf.Serializer.Deserialize[T](stream source) at TimeZoneNames.TimeZoneData.Load() at TimeZoneNames.TZNames.cctor() --- End of inner exception stack trace --- at TimeZoneNames.TZNames.GetLanguageKey(string languageCode) at TimeZoneNames.TZNames.GetNamesForTimeZone(String timeZoneId, String languageCode)
Seemed really odd to me, but I thought I'd see what you thought Matt.