0
votes

I am using ProtoBuf for .Net successfully in VS2012. When I import a library I developed there to Xamarin Studio, intellisense doesn't work on the ProtoBuf namespace. It compiles OK, but the code is peppered with red highlights for all the members that intellisense doesn't recognise. ProtoBuf supplies an xml file to support intellisense, but when I try to load it into Xamarin Studio's XML schemas I get the error below.

I'm trying to doctor the file by including a namespace in the xml header. I'm using the protobuf-net.xml file supplied for mono (Full version), but I suspect that;s for MonoDevelop. Is there not one that works out-of-the-box for Xamarin Studio? I have a Xamarin Indie license, so not using VS for mobile development. I'm using VS to write a TCP server for my mobile apps to connect to and ProtoBuf to handle the serialization of the application protocol.

Perhaps I'm being dumb and not using the supplied intellisense XML file correctly. If I'm not supposed to add it to the XML schemas, then how do I use it to make Xamarin Studio intellisense work? Marc Gravel... I'm sure you're da MAN for this question...

Xamarin Studio version 4.2.5 (build 0), protobuf-net r668.

------EDIT-------

I solved this problem by editing my solution file and changing the order of the projects. Since Xamarin Studio does not support Build Order the way VS does, this was causing dependency issues. Funny that manually compiling in the correct order did not resolve the problem, but the intellisense magically works without importing the protobuf-net.xml file? Go figure...

Thanks Marc Gravell for a great product in ProtoBuf!

------EDIT------

Output from XML Schema Add:

System.Xml.Schema.XmlSchemaException: XmlSchema error: The top level schema must have namespace http://www.w3.org/2001/XMLSchema at System.Xml.Schema.XmlSchema.Read (System.Xml.XmlReader reader, System.Xml.Schema.ValidationEventHandler validationEventHandler) [0x000e7] in /private/tmp/source/bockbuild-mono-3.2.6/profiles/mono-mac-xamarin/build-root/mono-3.2.6/mcs/class/System.XML/System.Xml.Schema/XmlSchema.cs:744 at MonoDevelop.XmlEditor.Completion.XmlSchemaCompletionData.ReadSchema (System.Xml.XmlReader reader) [0x00010] in /Users/builder/data/lanes/845/95ac543f/source/monodevelop/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor.Completion/XmlSchemaCompletionData.cs:465 at MonoDevelop.XmlEditor.Completion.XmlSchemaCompletionData.ReadSchema (System.String baseUri, System.IO.TextReader reader) [0x00016] in /Users/builder/data/lanes/845/95ac543f/source/monodevelop/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor.Completion/XmlSchemaCompletionData.cs:481 at MonoDevelop.XmlEditor.Completion.XmlSchemaCompletionData..ctor (System.String baseUri, System.String fileName, Boolean lazyLoadFile) [0x00067] in /Users/builder/data/lanes/845/95ac543f/source/monodevelop/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor.Completion/XmlSchemaCompletionData.cs:100 at MonoDevelop.XmlEditor.Completion.XmlSchemaCompletionData..ctor (System.String baseUri, System.String fileName) [0x00000] in /Users/builder/data/lanes/845/95ac543f/source/monodevelop/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor.Completion/XmlSchemaCompletionData.cs:88 at MonoDevelop.XmlEditor.Completion.XmlSchemaCompletionData..ctor (System.String fileName) [0x00000] in /Users/builder/data/lanes/845/95ac543f/source/monodevelop/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor.Completion/XmlSchemaCompletionData.cs:80 at MonoDevelop.XmlEditor.Gui.XmlSchemasPanelWidget.addRegisteredSchema (System.Object sender, System.EventArgs args) [0x00022] in /Users/builder/data/lanes/845/95ac543f/source/monodevelop/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor.Gui/XmlSchemasPanelWidget.cs:379

1
Well, that's odd. The intellisense file is just regular intellisense - nothing special there. I have absolutely no idea what that is, but I do have a shiny Xamarin license that I need to put to good use; adding to my list...Marc Gravell
Adding the Protobuf XML file to Xamarin Studio's list of XML schemas is not required for code completion to work. Adding an XML schema into the list of XML schemas only affects which schemas are available for code completion in the XML editor when writing XML files. Xamarin Studio should pick up the assembly .xml file if it is next to the .dll. So probably need more information on why it is not working in your case. For a simple project using the Protobuf NuGet package the code completion seems OK.Matt Ward

1 Answers

0
votes

Do you have xml file next to dll file? I just created new console project added "protobuf-net" via NuGet and this is result:

MonoDevelop with intelisense example

I didn't add any xml anywhere. Also about XamarinStudio vs MonoDevelop this is same thing only difference is that XamarinStudio comes bundled with few extra mobile AddIns("Plugins") but functionality as this are identical(same source code).