Closed kochizufan closed 9 years ago
Similar error also occured in iOS sample:
Error position: same with Android
Error messages:
ProtoBuf.ProtoException: Invalid wire-type; this usually means you have over-written a file without truncating or setting the length; see http://stackoverflow.com/q/2152978/23354
at ProtoBuf.ProtoReader.SkipField () [0x00000] in <filename unknown>:0
at ProtoBuf.Meta.TypeModel.TryDeserializeAuxiliaryType (ProtoBuf.ProtoReader reader, DataFormat format, Int32 tag, System.Type type, System.Object& value, Boolean skipOtherFields, Boolean asListItem, Boolean autoCreate, Boolean insideList) [0x00000] in <filename unknown>:0
at ProtoBuf.Meta.TypeModel.TryDeserializeList (ProtoBuf.Meta.TypeModel model, ProtoBuf.ProtoReader reader, DataFormat format, Int32 tag, System.Type listType, System.Type itemType, System.Object& value) [0x00000] in <filename unknown>:0
at ProtoBuf.Meta.TypeModel.TryDeserializeAuxiliaryType (ProtoBuf.ProtoReader reader, DataFormat format, Int32 tag, System.Type type, System.Object& value, Boolean skipOtherFields, Boolean asListItem, Boolean autoCreate, Boolean insideList) [0x00000] in <filename unknown>:0
at ProtoBuf.Meta.TypeModel.DeserializeCore (ProtoBuf.ProtoReader reader, System.Type type, System.Object value, Boolean noAutoCreate) [0x00000] in <filename unknown>:0
at ProtoBuf.Meta.TypeModel.Deserialize (System.IO.Stream source, System.Object value, System.Type type, ProtoBuf.SerializationContext context) [0x00000] in <filename unknown>:0
at ProtoBuf.Meta.TypeModel.Deserialize (System.IO.Stream source, System.Object value, System.Type type) [0x00000] in <filename unknown>:0
at OsmSharp.Utilities.DeserializeWithSize (ProtoBuf.Meta.RuntimeTypeModel model, System.IO.Stream source, System.Object value, System.Type type) [0x0002c] in /Users/kokogiko/Projects/MapApp/OsmSharp/OsmSharp/Utilities.cs:620
at OsmSharp.Collections.Tags.Serializer.TagsCollectionSerializer.DeserializeWithSize (System.IO.Stream stream) [0x00026] in /Users/kokogiko/Projects/MapApp/OsmSharp/OsmSharp/Collections/Tags/Serializer/TagsCollectionSerializer.cs:57
at OsmSharp.UI.Renderer.Scene.Storage.SceneSerializer.Deserialize (System.IO.Stream stream, Boolean compress, OsmSharp.Collections.Tags.TagsCollectionBase& metaData) [0x0000e] in /Users/kokogiko/Projects/MapApp/OsmSharp/OsmSharp.UI/Renderer/Scene/Storage/SceneSerializer.cs:202
at OsmSharp.UI.Renderer.Scene.Scene2D.Deserialize (System.IO.Stream stream, Boolean compress, OsmSharp.Collections.Tags.TagsCollectionBase& metaData) [0x0000e] in /Users/kokogiko/Projects/MapApp/OsmSharp/OsmSharp.UI/Renderer/Scene/Scene2D.cs:651
at OsmSharp.UI.Renderer.Scene.Scene2D.Deserialize (System.IO.Stream stream, Boolean compress) [0x00005] in /Users/kokogiko/Projects/MapApp/OsmSharp/OsmSharp.UI/Renderer/Scene/Scene2D.cs:663
at OsmSharp.iOS.UI.Sample.SampleViewController.LoadView () [0x00034] in /Users/kokogiko/Projects/MapApp/OsmSharp/OsmSharp.iOS.UI.Sample/SampleViewController.cs:110
at at (wrapper managed-to-native) MonoTouch.ObjCRuntime.Messaging:void_objc_msgSend (intptr,intptr)
at MonoTouch.UIKit.UIWindow.MakeKeyAndVisible () [0x00008] in /Developer/MonoTouch/Source/monotouch/src/build/compat/UIKit/UIWindow.g.cs:215
at OsmSharp.iOS.UI.Sample.AppDelegate.FinishedLaunching (MonoTouch.UIKit.UIApplication app, MonoTouch.Foundation.NSDictionary options) [0x00038] in /Users/kokogiko/Projects/MapApp/OsmSharp/OsmSharp.iOS.UI.Sample/AppDelegate.cs:23
at at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0004c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:39
at OsmSharp.iOS.UI.Sample.Application.Main (System.String[] args) [0x00008] in /Users/kokogiko/Projects/MapApp/OsmSharp/OsmSharp.iOS.UI.Sample/Main.cs:35
Environment: Xamarin Studio 5.3 Xamatin.iOS 7.4.0.108 Tested device: iPhone5S with iOS 7.1.2
I get exactly the same exception in the Android.Routing.Offline project on a tap event. Inside the Router.cs
var fromResolved = router.Resolve(Vehicle.Car, from); // Line 52
Thanks, is on the TODO-list this one!
The OsmSharp.Android.UI.Sample works prefectly when I test the sample .map files (default.map or blue.map).
var sceneStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(@"OsmSharp.Android.UI.Sample.default.map"); map.AddLayer(new LayerScene(Scene2D.Deserialize(sceneStream, true)));
But when I am trying to test it with .map sample files from mapsforge (http://download.mapsforge.org/maps/) I am getting a ProtoBuf.ProtoException: Invalid field in source data: 0 in Utilities.cs inside SerializeWithSize:
return model.Deserialize(cappedStream, value, type);
Any idea how I could fix that? Is it something that I am doing wrong?
The maps from mapsforge are not compatible with the maps generated by OsmSharp, sorry about that.
And all the samples should work again. Feel free to reopen this issue if there are still problems.
OsmSharp.Android.UI.Sample stopped with error.
Position of error: Utilities.cs line 620
Error messages:
Environment: Xamarin Studio 5.3 Xamatin.Android 4.16.0 Tested device: Samsung Galaxy S5 with Android 4.4