From this code a Null exception is throw and I'm pusled as to why that is. The line that throws the NullReferenceException is this one,
if (await dbConn.FindAsync<ShoppingList>(x => x.Name == insertedList.Name) != null)
Here is the whole method:
public async Task<string> SaveSingleShoppingList(IShoppingList shoppingList)
{
try
{
var dbConn = new SQLiteAsyncConnection(dbPath);
ShoppingList insertedList = (ShoppingList)shoppingList;
await SaveGroceries(shoppingList.Groceries, shoppingList.Name, dbConn);
if(await dbConn.FindAsync<ShoppingList>(x => x.Name == insertedList.Name) != null)
await dbConn.UpdateAsync(insertedList);
else
await dbConn.InsertAsync(insertedList);
return "Shopping list Saved!";
}
catch (SQLiteException ex)
{
return ex.Message;
}
catch(NullReferenceException nre)
{
return nre.Message;
}
}
Below is the full extent of the exception message
{System.NullReferenceException: Object reference not set to an
instance of an object at
SQLite.TableQuery1[ShoppingAssistant.ShoppingList].CompileExpr
(System.Linq.Expressions.Expression expr,
System.Collections.Generic.List1 queryArgs) [0x00000] in :0
at SQLite.TableQuery1[ShoppingAssistant.ShoppingList].CompileExpr
(System.Linq.Expressions.Expression expr,
System.Collections.Generic.List1 queryArgs) [0x00000] in :0
at
SQLite.TableQuery1[ShoppingAssistant.ShoppingList].GenerateCommand
(System.String selectionList) [0x00000] in <filename unknown>:0 at
SQLite.TableQuery1[ShoppingAssistant.ShoppingList].GetEnumerator ()
[0x00000] in :0
at
System.Collections.Generic.List1[ShoppingAssistant.ShoppingList].AddEnumerable
(IEnumerable1 enumerable) [0x00000] in :0
at
System.Collections.Generic.List1[ShoppingAssistant.ShoppingList]..ctor
(IEnumerable1 collection) [0x00000] in :0
at System.Linq.Enumerable.ToList[ShoppingList] (IEnumerable`1
source) [0x00000] in :0
at
SQLite.TableQuery`1[ShoppingAssistant.ShoppingList].FirstOrDefault ()
[0x00000] in :0
at SQLite.SQLiteConnection.Find[ShoppingList]
(System.Linq.Expressions.Expression`1 predicate) [0x00000] in
:0
at
SQLite.SQLiteAsyncConnection+c__AnonStorey7`1[ShoppingAssistant.ShoppingList].<>m__0
() [0x00000] in :0
at
System.Threading.Tasks.TaskActionInvoker+FuncInvoke`1[ShoppingAssistant.ShoppingList].Invoke
(System.Threading.Tasks.Task owner, System.Object state,
System.Threading.Tasks.Task context) [0x00000] in :0
at System.Threading.Tasks.Task.InnerInvoke () [0x00000] in :0 at System.Threading.Tasks.Task.ThreadStart () [0x00000]
in :0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw ()
[0x00000] in :0 at
System.Runtime.CompilerServices.TaskAwaiter`1[ShoppingAssistant.ShoppingList].GetResult
() [0x00000] in :0 at
ShoppingAssistant.SQLiteDataAcces+d__2d.MoveNext
() [0x0009d] in
c:\Users\kaj\Desktop\dbTest\dbTest\SQLiteDataAcces.cs:187
} System.NullReferenceException
Related
Hi I am trying to query my Mongo Database by using a list of Facebook ID's as the parameter in order to return the list of users with corresponding accounts. The method works fine in the Unity Editor however when I run it on iOS I get a constructor error (I have set a blank default constructor in order to solve the issue however it still doesn't work)
Error
MissingMethodException: Method not found: 'Default constructor not found...ctor() of MongoDB.Driver.CommandResultSerializer'.
at System.Activator.CreateInstance (System.Type type, System.Object[] args) [0x00000] in <filename unknown>:0
at MongoDB.Bson.Serialization.Attributes.BsonSerializerAttribute.CreateSerializer (System.Type type) [0x00000] in <filename unknown>:0
at MongoDB.Bson.Serialization.BsonSerializer.LookupSerializer (System.Type type) [0x00000] in <filename unknown>:0
at MongoDB.Driver.MongoServerInstance.RunCommandAs[TCommandResult] (MongoDB.Driver.Internal.MongoConnection connection, System.String databaseName, IMongoCommand command) [0x00000] in <filename unknown>:0
at MongoDB.Driver.MongoServerInstance.Ping (MongoDB.Driver.Internal.MongoConnection connection) [0x00000] in <filename unknown>:0
at MongoDB.Driver.MongoServerInstance.Connect () [0x00000] in <filename unknown>:0
at MongoDB.Driver.Internal.DirectMongoServerProxy.Connect (TimeSpan timeout, MongoDB.Driver.ReadPreference readPreference) [0x00000] in <filename unknown>:0
at Tacticsoft.Examples.SimpleTableViewController.FriendsHighscoreHndlr (IGraphResult FBresult) [0x00000] in <filename unknown>:0
at Facebook.Unity.AsyncRequestString+<Start>c__Iterator0.MoveNext () [0x00000] in <filename unknown>:0
at UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) [0x00000] in <filename unknown>:0
Rethrow as MongoConnectionException: Unable to connect to server XXX.XXX.XX.XX:XXXX: Method not found: 'Default constructor not found...ctor() of MongoDB.Driver.CommandResultSerializer'..
at MongoDB.Driver.Internal.DirectMongoServerProxy.Connect (TimeSpan timeout, MongoDB.Driver.ReadPreference readPreference) [0x00000] in <filename unknown>:0
at Tacticsoft.Examples.SimpleTableViewController.FriendsHighscoreHndlr (IGraphResult FBresult) [0x00000] in <filename unknown>:0
at Facebook.Unity.AsyncRequestString+<Start>c__Iterator0.MoveNext () [0x00000] in <filename unknown>:0
at UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) [0x00000] in <filename unknown>:0
Initial Method
public void FetchData()
{
//data = Mongo.Instance.players.FindAll().ToList();
if (FB.IsLoggedIn)
{
FB.API("me/friends", HttpMethod.GET, FriendsHighscoreHndlr);
}
}
Callback Method
public void FriendsHighscoreHndlr (IGraphResult FBresult)
{
var dict = Json.Deserialize(FBresult.ToString()) as Dictionary<string,object>;
var friendList = new List<object>();
friendList = (List<object>)(dict["data"]);
int _friendCount = friendList.Count;
Debug.Log("Found friends on FB, _friendCount ... " +_friendCount);
List<string> friendIDsFromFB = new List<string>();
for (int i=0; i<_friendCount; i++) {
string friendFBID = getDataValueForKey( (Dictionary<string,object>)(friendList[i]), "id");
string friendName = getDataValueForKey( (Dictionary<string,object>)(friendList[i]), "name");
Debug.Log( i +"/" +_friendCount +" " +friendFBID +" " +friendName);
friendIDsFromFB.Add(friendFBID);
}
//friendIDsFromFB.Add(AccessToken.CurrentAccessToken.UserId);
var query = Query.In("facebookID", BsonArray.Create(friendIDsFromFB));
//Debug.Log(query);
data = Mongo.Instance.players.Find(query).ToList();
}
Data Value for Key Method
private string getDataValueForKey(Dictionary<string, object> dict, string key) {
object objectForKey;
if (dict.TryGetValue(key, out objectForKey)) {
return (string)objectForKey;
} else {
return "";
}
}
Return Query Result
{
"_id" : ObjectId("XXXXXX"),
"facebookID" : "XXXXXXXXXXXXXX",
"name" : "John Doe",
"highScore" : 40501
}
I update my Unity from 5.2 to 5.6, this is success. But after update, i can't open file script. This is Error
The file '/Users/vietbac/Desktop/New Unity Project 1/Assets/NewBehaviourScript.cs' could not be opened. Error while loading style :Default
System.IO.IOException: Error while loading style :Default --->
System.TypeInitializationException: An exception was thrown by the
type initializer for System.Drawing.KnownColors --->
System.TypeInitializationException: An exception was thrown by the
type initializer for System.Drawing.GDIPlus --->
System.DllNotFoundException:
/Applications/Unity/MonoDevelop.app/Contents/MacOS/../Frameworks/Mono.framework/Versions/2.10.12/lib/libgdiplus.dylib
at (wrapper managed-to-native) System.Drawing.GDIPlus:GdiplusStartup
(ulong&,System.Drawing.GdiplusStartupInput&,System.Drawing.GdiplusStartupOutput&)
at System.Drawing.GDIPlus..cctor () [0x00000] in :0
--- End of inner exception stack trace --- at System.Drawing.KnownColors..cctor () [0x00000] in :0
--- End of inner exception stack trace --- at System.Drawing.ColorConverter.StaticConvertFromString
(ITypeDescriptorContext context, System.String s,
System.Globalization.CultureInfo culture) [0x00000] in :0 at System.Drawing.ColorConverter.ConvertFrom
(ITypeDescriptorContext context, System.Globalization.CultureInfo
culture, System.Object value) [0x00000] in :0 at
System.ComponentModel.TypeConverter.ConvertFrom (System.Object o)
[0x00000] in :0 at
System.ComponentModel.TypeConverter.ConvertFromString (System.String
text) [0x00000] in :0 at
System.Drawing.ColorTranslator.FromHtml (System.String htmlColor)
[0x00000] in :0 at
Mono.TextEditor.Highlighting.ColorScheme.GetColorFromString
(System.String colorString) [0x001c0] in
/home/builduser/buildslave/monodevelop/build/monodevelop/main/src/core/Mono.Texteditor/Mono.TextEditor.Highlighting/ColorScheme.cs:578
at Mono.TextEditor.Highlighting.ColorScheme.SetChunkStyle
(System.String name, System.String weight, System.String foreColor,
System.String backColor) [0x00038] in
/home/builduser/buildslave/monodevelop/build/monodevelop/main/src/core/Mono.Texteditor/Mono.TextEditor.Highlighting/ColorScheme.cs:514
at Mono.TextEditor.Highlighting.ColorScheme.ReadStyleTree
(System.Xml.XmlReader reader, Mono.TextEditor.Highlighting.ColorScheme
result, System.String curName, System.String curWeight, System.String
curColor, System.String curBgColor) [0x000b8] in
/home/builduser/buildslave/monodevelop/build/monodevelop/main/src/core/Mono.Texteditor/Mono.TextEditor.Highlighting/ColorScheme.cs:599
at
Mono.TextEditor.Highlighting.ColorScheme+c__AnonStorey32.<>m__43
() [0x000e0] in
/home/builduser/buildslave/monodevelop/build/monodevelop/main/src/core/Mono.Texteditor/Mono.TextEditor.Highlighting/ColorScheme.cs:625
at
Mono.TextEditor.Highlighting.XmlReadHelper+c__AnonStorey19.<>m__D
(Mono.TextEditor.Highlighting.ReadCallbackData data) [0x00000] in
/home/builduser/buildslave/monodevelop/build/monodevelop/main/src/core/Mono.Texteditor/Mono.TextEditor.Highlighting/XmlReadHelper.cs:55
at Mono.TextEditor.Highlighting.XmlReadHelper.ReadList
(System.Xml.XmlReader reader, ICollection1 endNodes,
Mono.TextEditor.Highlighting.ReaderCallbackWithData callback)
[0x0008b] in
/home/builduser/buildslave/monodevelop/build/monodevelop/main/src/core/Mono.Texteditor/Mono.TextEditor.Highlighting/XmlReadHelper.cs:91
at Mono.TextEditor.Highlighting.XmlReadHelper.ReadList
(System.Xml.XmlReader reader, ICollection1 endNodes,
Mono.TextEditor.Highlighting.ReaderCallback callback) [0x0000d] in
/home/builduser/buildslave/monodevelop/build/monodevelop/main/src/core/Mono.Texteditor/Mono.TextEditor.Highlighting/XmlReadHelper.cs:54
at Mono.TextEditor.Highlighting.XmlReadHelper.ReadList
(System.Xml.XmlReader reader, System.String endNode,
Mono.TextEditor.Highlighting.ReaderCallback callback) [0x00000] in
/home/builduser/buildslave/monodevelop/build/monodevelop/main/src/core/Mono.Texteditor/Mono.TextEditor.Highlighting/XmlReadHelper.cs:50
at Mono.TextEditor.Highlighting.ColorScheme.LoadFrom
(System.Xml.XmlReader reader) [0x00018] in
/home/builduser/buildslave/monodevelop/build/monodevelop/main/src/core/Mono.Texteditor/Mono.TextEditor.Highlighting/ColorScheme.cs:615
at Mono.TextEditor.Highlighting.SyntaxModeService.LoadStyle
(System.String name) [0x0003c] in
/home/builduser/buildslave/monodevelop/build/monodevelop/main/src/core/Mono.Texteditor/Mono.TextEditor.Highlighting/SyntaxModeService.cs:111
--- End of inner exception stack trace --- at Mono.TextEditor.Highlighting.SyntaxModeService.LoadStyle
(System.String name) [0x00053] in
/home/builduser/buildslave/monodevelop/build/monodevelop/main/src/core/Mono.Texteditor/Mono.TextEditor.Highlighting/SyntaxModeService.cs:113
at Mono.TextEditor.Highlighting.SyntaxModeService.GetColorStyle
(System.String name) [0x0002c] in
/home/builduser/buildslave/monodevelop/build/monodevelop/main/src/core/Mono.Texteditor/Mono.TextEditor.Highlighting/SyntaxModeService.cs:83
at Mono.TextEditor.TextEditorOptions.GetColorStyle () [0x00000] in
/home/builduser/buildslave/monodevelop/build/monodevelop/main/src/core/Mono.Texteditor/Mono.TextEditor/TextEditorOptions.cs:492
at MonoDevelop.SourceEditor.StyledSourceEditorOptions.GetColorStyle ()
[0x00000] in
/home/builduser/buildslave/monodevelop/build/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/StyledSourceEditorOptions.cs:192
at Mono.TextEditor.TextArea.OptionsChanged (System.Object sender,
System.EventArgs args) [0x00038] in
/home/builduser/buildslave/monodevelop/build/monodevelop/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextArea.cs:685
at Mono.TextEditor.TextArea.set_Options (ITextEditorOptions value)
[0x00066] in
/home/builduser/buildslave/monodevelop/build/monodevelop/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextArea.cs:157
at Mono.TextEditor.TextEditor.set_Options (ITextEditorOptions value)
[0x00000] in
/home/builduser/buildslave/monodevelop/build/monodevelop/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextEditor.cs:414
at MonoDevelop.SourceEditor.ExtensibleTextEditor..ctor
(MonoDevelop.SourceEditor.SourceEditorView view) [0x00028] in
/home/builduser/buildslave/monodevelop/build/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/ExtensibleTextEditor.cs:75
at MonoDevelop.SourceEditor.SourceEditorWidget..ctor
(MonoDevelop.SourceEditor.SourceEditorView view) [0x00077] in
/home/builduser/buildslave/monodevelop/build/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorWidget.cs:284
at MonoDevelop.SourceEditor.SourceEditorView..ctor () [0x000ca] in
/home/builduser/buildslave/monodevelop/build/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs:189
at MonoDevelop.SourceEditor.SourceEditorDisplayBinding.CreateContent
(FilePath fileName, System.String mimeType,
MonoDevelop.Projects.Project ownerProject) [0x00000] in
/home/builduser/buildslave/monodevelop/build/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorDisplayBinding.cs:94
at MonoDevelop.Ide.Gui.LoadFileWrapper.Invoke (System.String fileName)
[0x00033] in
/home/builduser/buildslave/monodevelop/build/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs:1182
i am using realm.xamarin 0.75 with xamarin forms and while executing query, i get a weird error. the query is
DateTimeOffset fromOffset = new DateTimeOffset(fromDate);
DateTimeOffset toOffset = new DateTimeOffset(toDate);
var config = DependencyService.Get<IDatabase>().GetConfiguration();
using (var realm = Realm.GetInstance(config))
{
return realm.All<Measurements>()Where(o => o.CreatedDateTime >= fromOffset && o.CreatedDateTime <= toOffset).OrderByDescending(o => o.CreatedDateTime).ToList();
}
And the error is:
UNHANDLED EXCEPTION:
06-06 17:46:15.337 I/MonoDroid(26505): Realms.RealmException: Data type mismatch
06-06 17:46:15.337 I/MonoDroid(26505): at Realms.NativeCommon.ExceptionThrower (NativeException exception) [0x00007] in <filename unknown>:0
06-06 17:46:15.337 I/MonoDroid(26505): at (wrapper native-to-managed) Realms.NativeCommon:ExceptionThrower (Realms.NativeException)
06-06 17:46:15.337 I/MonoDroid(26505): at (wrapper managed-to-native) Realms.NativeQuery:timestamp_milliseconds_greater_equal (Realms.QueryHandle,intptr,long)
06-06 17:46:15.337 I/MonoDroid(26505): at Realms.RealmResultsVisitor.AddQueryGreaterThanOrEqual (Realms.QueryHandle queryHandle, System.String columnName, System.Object value) [0x000b6] in <filename unknown>:0
06-06 17:46:15.337 I/MonoDroid(26505): at Realms.RealmResultsVisitor.VisitBinary (System.Linq.Expressions.BinaryExpression b) [0x0016c] in <filename unknown>:0
06-06 17:46:15.337 I/MonoDroid(26505): at Realms.ExpressionVisitor.Visit (System.Linq.Expressions.Expression exp) [0x000d2] in <filename unknown>:0
06-06 17:46:15.337 I/MonoDroid(26505): at Realms.RealmResultsVisitor.VisitCombination (System.Linq.Expressions.BinaryExpression b, System.Action`1 combineWith) [0x00012] in <filename unknown>:0
06-06 17:46:15.337 I/MonoDroid(26505): at Realms.RealmResultsVisitor.VisitBinary (System.Linq.Expressions.BinaryExpression b) [0x0000c] in <filename unknown>:0
06-06 17:46:15.337 I/MonoDroid(26505): at Realms.ExpressionVisitor.Visit (System.Linq.Expressions.Expression exp) [0x000d2] in <filename unknown>:0
06-06 17:46:15.337 I/MonoDroid(26505): at Realms.RealmResultsVisitor.VisitMethodCall (System.Linq.Expressions.MethodCallExpression m) [0x0006a] in <filename unknown>:0
06-06 17:46:15.337 I/MonoDroid(26505): at Realms.ExpressionVisitor.Visit (System.Linq.Expressions.Expression exp) [0x000ec] in <filename unknown>:0
06-06 17:46:15.337 I/MonoDroid(26505): at Realms.RealmResultsVisitor.VisitMethodCall (System.Linq.Expressions.MethodCallExpression m) [0x000e6] in <filename unknown>:0
06-06 17:46:15.337 I/MonoDroid(26505): at Realms.ExpressionVisitor.Visit (System.Linq.Expressions.Expression exp) [0x000ec] in <filename unknown>:0
06-06 17:46:15.337 I/MonoDroid(26505): at Realms.RealmResults`1[T].CreateResultsHandle () [0x00037] in <filename unknown>:0
06-06 17:46:15.337 I/MonoDroid(26505): at Realms.RealmResults`1[T].get_ResultsHandle () [0x0000d] in <filename unknown>:0
06-06 17:46:15.337 I/MonoDroid(26505): at Realms.RealmResults`1[T].GetEnumerator () [0x00000] in <filename unknown>:0
06-06 17:46:15.337 I/MonoDroid(26505): at System.Collections.Generic.List`1[T]..ctor (IEnumerable`1 collection) [0x00073] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/collections/generic/list.cs:104
06-06 17:46:15.337 I/MonoDroid(26505): at System.Linq.Enumerable.ToList[TSource] (IEnumerable`1 source) [0x00011] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/System.Core/System/Linq/Enumerable.cs:835
i suscpect DateTimeOffset could be causing the issue.
i checked the source code at https://github.com/realm/realm-dotnet
but couldn't find anything.
I found the issue. It happens when the class for RealmObject(in my case Measurements) is not inheriting directly from RealmObject.
My class Measurements was inheriting from a class BaseModel (i created this class for internal purpose) and this BaseModel class was inheriting from RealmObject.
When i removed this and made Measurements inherit directly from RealmObject, i doesn't throws exception.
From Dimitris Tavlikos 's comment,
Realm Xamarin does not allow models to be further subclassed in any way. The CreateObject generic method only works if you use it for a class which descends directly from RealmObject.
https://realm.io/docs/xamarin/latest/#model-inheritance
With DotCMIS I can successfully start a session to an Alfresco 4.0.1 CMIS server.
But when I call session.GetRootFolder(), I get the exception below:
Unhandled Exception: DotCMIS.Exceptions.CmisConnectionException: Parsing exception! ---> System.InvalidOperationException: There is an error in XML document. ---> System.InvalidOperationException: Read by order only possible for encoded/bare format
at System.Xml.Serialization.ClassMap.GetElement (Int32 index) [0x00000] in <filename unknown>:0
at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadMembers (System.Xml.Serialization.ClassMap map, System.Object ob, Boolean isValueList, Boolean readBySoapOrder) [0x00000] in <filename unknown>:0
at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadClassInstanceMembers (System.Xml.Serialization.XmlTypeMapping typeMap, System.Object ob) [0x00000] in <filename unknown>:0
at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadClassInstance (System.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable, Boolean checkType) [0x00000] in <filename unknown>:0
at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadObject (System.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable, Boolean checkType) [0x00000] in <filename unknown>:0
at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadObjectElement (System.Xml.Serialization.XmlTypeMapElementInfo elem) [0x00000] in <filename unknown>:0
at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadMembers (System.Xml.Serialization.ClassMap map, System.Object ob, Boolean isValueList, Boolean readBySoapOrder) [0x00000] in <filename unknown>:0
at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadClassInstanceMembers (System.Xml.Serialization.XmlTypeMapping typeMap, System.Object ob) [0x00000] in <filename unknown>:0
at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadClassInstance (System.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable, Boolean checkType) [0x00000] in <filename unknown>:0
at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadObject (System.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable, Boolean checkType) [0x00000] in <filename unknown>:0
at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadRoot (System.Xml.Serialization.XmlTypeMapping rootMap) [0x00000] in <filename unknown>:0
at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadRoot () [0x00000] in <filename unknown>:0
at System.Xml.Serialization.XmlSerializer.Deserialize (System.Xml.Serialization.XmlSerializationReader reader) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Xml.Serialization.XmlSerializer.Deserialize (System.Xml.Serialization.XmlSerializationReader reader) [0x00000] in <filename unknown>:0
at System.Xml.Serialization.XmlSerializer.Deserialize (System.Xml.XmlReader xmlReader) [0x00000] in <filename unknown>:0
at DotCMIS.Binding.AtomPub.AtomPubParser.DeserializeObject (System.Xml.XmlReader reader) [0x00000] in <filename unknown>:0
at DotCMIS.Binding.AtomPub.AtomPubParser.ParseElement (System.Xml.XmlReader reader) [0x00000] in <filename unknown>:0
at DotCMIS.Binding.AtomPub.AtomPubParser.ParseEntry (System.Xml.XmlReader reader) [0x00000] in <filename unknown>:0
at DotCMIS.Binding.AtomPub.AtomPubParser.Parse () [0x00000] in <filename unknown>:0
at DotCMIS.Binding.AtomPub.AbstractAtomPubService.Parse[AtomEntry] (System.IO.Stream stream) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at DotCMIS.Binding.AtomPub.AbstractAtomPubService.Parse[AtomEntry] (System.IO.Stream stream) [0x00000] in <filename unknown>:0
at DotCMIS.Binding.AtomPub.AbstractAtomPubService.GetObjectInternal (System.String repositoryId, IdentifierType idOrPath, System.String objectIdOrPath, Nullable`1 returnVersion, System.String filter, Nullable`1 includeAllowableActions, Nullable`1 includeRelationships, System.String renditionFilter, Nullable`1 includePolicyIds, Nullable`1 includeAcl, IExtensionsData extension) [0x00000] in <filename unknown>:0
at DotCMIS.Binding.AtomPub.ObjectService.GetObject (System.String repositoryId, System.String objectId, System.String filter, Nullable`1 includeAllowableActions, Nullable`1 includeRelationships, System.String renditionFilter, Nullable`1 includePolicyIds, Nullable`1 includeAcl, IExtensionsData extension) [0x00000] in <filename unknown>:0
at DotCMIS.Client.Impl.Session.GetObject (System.String objectId, IOperationContext context) [0x00000] in <filename unknown>:0
at DotCMIS.Client.Impl.Session.GetObject (IObjectId objectId, IOperationContext context) [0x00000] in <filename unknown>:0
at DotCMIS.Client.Impl.Session.GetRootFolder (IOperationContext context) [0x00000] in <filename unknown>:0
at DotCMIS.Client.Impl.Session.GetRootFolder () [0x00000] in <filename unknown>:0
at tests.sln.MainClass.Main (System.String[] args) [0x00074] in /home/nico/src/CmisSync/tests/tests.sln/Main.cs:27
[ERROR] FATAL UNHANDLED EXCEPTION: DotCMIS.Exceptions.CmisConnectionException: Parsing exception! ---> System.InvalidOperationException: There is an error in XML document. ---> System.InvalidOperationException: Read by order only possible for encoded/bare format
at System.Xml.Serialization.ClassMap.GetElement (Int32 index) [0x00000] in <filename unknown>:0
at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadMembers (System.Xml.Serialization.ClassMap map, System.Object ob, Boolean isValueList, Boolean readBySoapOrder) [0x00000] in <filename unknown>:0
at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadClassInstanceMembers (System.Xml.Serialization.XmlTypeMapping typeMap, System.Object ob) [0x00000] in <filename unknown>:0
at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadClassInstance (System.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable, Boolean checkType) [0x00000] in <filename unknown>:0
at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadObject (System.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable, Boolean checkType) [0x00000] in <filename unknown>:0
at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadObjectElement (System.Xml.Serialization.XmlTypeMapElementInfo elem) [0x00000] in <filename unknown>:0
at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadMembers (System.Xml.Serialization.ClassMap map, System.Object ob, Boolean isValueList, Boolean readBySoapOrder) [0x00000] in <filename unknown>:0
at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadClassInstanceMembers (System.Xml.Serialization.XmlTypeMapping typeMap, System.Object ob) [0x00000] in <filename unknown>:0
at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadClassInstance (System.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable, Boolean checkType) [0x00000] in <filename unknown>:0
at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadObject (System.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable, Boolean checkType) [0x00000] in <filename unknown>:0
at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadRoot (System.Xml.Serialization.XmlTypeMapping rootMap) [0x00000] in <filename unknown>:0
at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadRoot () [0x00000] in <filename unknown>:0
at System.Xml.Serialization.XmlSerializer.Deserialize (System.Xml.Serialization.XmlSerializationReader reader) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Xml.Serialization.XmlSerializer.Deserialize (System.Xml.Serialization.XmlSerializationReader reader) [0x00000] in <filename unknown>:0
at System.Xml.Serialization.XmlSerializer.Deserialize (System.Xml.XmlReader xmlReader) [0x00000] in <filename unknown>:0
at DotCMIS.Binding.AtomPub.AtomPubParser.DeserializeObject (System.Xml.XmlReader reader) [0x00000] in <filename unknown>:0
at DotCMIS.Binding.AtomPub.AtomPubParser.ParseElement (System.Xml.XmlReader reader) [0x00000] in <filename unknown>:0
at DotCMIS.Binding.AtomPub.AtomPubParser.ParseEntry (System.Xml.XmlReader reader) [0x00000] in <filename unknown>:0
at DotCMIS.Binding.AtomPub.AtomPubParser.Parse () [0x00000] in <filename unknown>:0
at DotCMIS.Binding.AtomPub.AbstractAtomPubService.Parse[AtomEntry] (System.IO.Stream stream) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at DotCMIS.Binding.AtomPub.AbstractAtomPubService.Parse[AtomEntry] (System.IO.Stream stream) [0x00000] in <filename unknown>:0
at DotCMIS.Binding.AtomPub.AbstractAtomPubService.GetObjectInternal (System.String repositoryId, IdentifierType idOrPath, System.String objectIdOrPath, Nullable`1 returnVersion, System.String filter, Nullable`1 includeAllowableActions, Nullable`1 includeRelationships, System.String renditionFilter, Nullable`1 includePolicyIds, Nullable`1 includeAcl, IExtensionsData extension) [0x00000] in <filename unknown>:0
at DotCMIS.Binding.AtomPub.ObjectService.GetObject (System.String repositoryId, System.String objectId, System.String filter, Nullable`1 includeAllowableActions, Nullable`1 includeRelationships, System.String renditionFilter, Nullable`1 includePolicyIds, Nullable`1 includeAcl, IExtensionsData extension) [0x00000] in <filename unknown>:0
at DotCMIS.Client.Impl.Session.GetObject (System.String objectId, IOperationContext context) [0x00000] in <filename unknown>:0
at DotCMIS.Client.Impl.Session.GetObject (IObjectId objectId, IOperationContext context) [0x00000] in <filename unknown>:0
at DotCMIS.Client.Impl.Session.GetRootFolder (IOperationContext context) [0x00000] in <filename unknown>:0
at DotCMIS.Client.Impl.Session.GetRootFolder () [0x00000] in <filename unknown>:0
An important part seems to be: Read by order only possible for encoded/bare format
My code is pretty much straight from the tutorial:
using System;
using System.Collections.Generic;
using DotCMIS;
using DotCMIS.Client.Impl;
using DotCMIS.Client;
using DotCMIS.Data.Impl;
using DotCMIS.Data.Extensions;
namespace tests.sln
{
class MainClass
{
public static void Main (string[] args)
{
// Connect to repository
Dictionary<string, string> parameters = new Dictionary<string, string>();
parameters[SessionParameter.BindingType] = BindingType.AtomPub;
parameters[SessionParameter.AtomPubUrl] = "http://localhost:8080/alfresco/cmisatom";
parameters[SessionParameter.User] = "admin";
parameters[SessionParameter.Password] = "admin";
SessionFactory factory = SessionFactory.NewInstance();
ISession session = factory.GetRepositories(parameters)[0].CreateSession();
Console.WriteLine("Created CMIS session: " + session.ToString());
// Get the root folder
IFolder rootFolder = session.GetRootFolder(); // Error happens here
}
}
}
What did I miss?
In debug mode I can see DotCMIS.Client.Impl.Session.GetObject (objectId="workspace://SpacesStore/77acb21f-811c-49a3-be4d-5cc7f177f461" in the stack, not sure what it means but 77acb21f-811c-49a3-be4d-5cc7f177f461 is indeed the node reference of Alfresco's company_home.
If I change the URL to http://localhost:8080/alfresco/service/cmisatom in the code above, then a Not Found error appears earlier, at the GetRepositories line. So I am pretty sure my URL is correct.
I downloaded the DotCMIS source code and am debugging it in Monodevelop now.
With Wireshark I have identified the packet on which the exception happens:
<?xml version='1.0' encoding='UTF-8'?><atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:cmis="http://docs.oasis-open.org/ns/cmis/core/200908/" xmlns:cmisra="http://docs.oasis-open.org/ns/cmis/restatom/200908/" xmlns:app="http://www.w3.org/2007/app"><atom:author><atom:name>System</atom:name></atom:author><atom:id>http://chemistry.apache.org/d29ya3NwYWNlOi8vU3BhY2VzU3RvcmUvNzdhY2IyMWYtODExYy00OWEzLWJlNGQtNWNjN2YxNzdmNDYx</atom:id><atom:published>2012-06-08T04:46:12Z</atom:published><atom:title>Company Home</atom:title><app:edited>2012-06-08T04:46:22Z</app:edited><atom:updated>2012-06-08T04:46:22Z</atom:updated><cmisra:object xmlns:ns3="http://docs.oasis-open.org/ns/cmis/messaging/200908/"><cmis:properties><cmis:propertyId queryName="cmis:allowedChildObjectTypeIds" displayName="Allowed Child Object Types Ids" localName="allowedChildObjectTypeIds" propertyDefinitionId="cmis:allowedChildObjectTypeIds" /><cmis:propertyId queryName="cmis:objectTypeId" displayName="Object Type Id" localName="objectTypeId" propertyDefinitionId="cmis:objectTypeId"><cmis:value>cmis:folder</cmis:value></cmis:propertyId><cmis:propertyString queryName="cmis:path" displayName="Path" localName="path" propertyDefinitionId="cmis:path"><cmis:value>/</cmis:value></cmis:propertyString><cmis:propertyString queryName="cmis:name" displayName="Name" localName="name" propertyDefinitionId="cmis:name"><cmis:value>Company Home</cmis:value></cmis:propertyString><cmis:propertyDateTime queryName="cmis:creationDate" displayName="Creation Date" localName="creationDate" propertyDefinitionId="cmis:creationDate"><cmis:value>2012-06-08T13:46:12.655+09:00</cmis:value></cmis:propertyDateTime><cmis:propertyString queryName="cmis:changeToken" displayName="Change token" localName="changeToken" propertyDefinitionId="cmis:changeToken" /><cmis:propertyString queryName="cmis:lastModifiedBy" displayName="Last Modified By" localName="lastModifiedBy" propertyDefinitionId="cmis:lastModifiedBy"><cmis:value>System</cmis:value></cmis:propertyString><cmis:propertyString queryName="cmis:createdBy" displayName="Created by" localName="createdBy" propertyDefinitionId="cmis:createdBy"><cmis:value>System</cmis:value></cmis:propertyString><cmis:propertyId queryName="cmis:objectId" displayName="Object Id" localName="objectId" propertyDefinitionId="cmis:objectId"><cmis:value>workspace://SpacesStore/77acb21f-811c-49a3-be4d-5cc7f177f461</cmis:value></cmis:propertyId><cmis:propertyId queryName="cmis:baseTypeId" displayName="Base Type Id" localName="baseTypeId" propertyDefinitionId="cmis:baseTypeId"><cmis:value>cmis:folder</cmis:value></cmis:propertyId><cmis:propertyId queryName="alfcmis:nodeRef" displayName="Alfresco Node Ref" localName="nodeRef" propertyDefinitionId="alfcmis:nodeRef"><cmis:value>workspace://SpacesStore/77acb21f-811c-49a3-be4d-5cc7f177f461</cmis:value></cmis:propertyId><cmis:propertyDateTime queryName="cmis:lastModificationDate" displayName="Last Modified Date" localName="lastModificationDate" propertyDefinitionId="cmis:lastModificationDate"><cmis:value>2012-06-08T13:46:22.049+09:00</cmis:value></cmis:propertyDateTime><cmis:propertyId queryName="cmis:parentId" displayName="Parent Id" localName="parentId" propertyDefinitionId="cmis:parentId" /><aspects:aspects xmlns="http://www.alfresco.org" xmlns:aspects="http://www.alfresco.org"><appliedAspects>P:app:uifacets</appliedAspects><properties><cmis:propertyString xmlns="http://docs.oasis-open.org/ns/cmis/core/200908/" propertyDefinitionId="app:icon"><value>space-icon-default</value></cmis:propertyString><cmis:propertyString xmlns="http://docs.oasis-open.org/ns/cmis/core/200908/" propertyDefinitionId="cm:description"><value>The company root space</value></cmis:propertyString><cmis:propertyString xmlns="http://docs.oasis-open.org/ns/cmis/core/200908/" propertyDefinitionId="cmis:policyText" /><cmis:propertyString xmlns="http://docs.oasis-open.org/ns/cmis/core/200908/" propertyDefinitionId="cm:title"><value>Company Home</value></cmis:propertyString></properties><appliedAspects>P:cm:titled</appliedAspects><appliedAspects>P:sys:localized</appliedAspects></aspects:aspects></cmis:properties><cmis:allowableActions><cmis:canDeleteObject>false</cmis:canDeleteObject><cmis:canUpdateProperties>true</cmis:canUpdateProperties><cmis:canGetFolderTree>true</cmis:canGetFolderTree><cmis:canGetProperties>true</cmis:canGetProperties><cmis:canGetObjectRelationships>true</cmis:canGetObjectRelationships><cmis:canGetObjectParents>false</cmis:canGetObjectParents><cmis:canGetFolderParent>false</cmis:canGetFolderParent><cmis:canGetDescendants>true</cmis:canGetDescendants><cmis:canMoveObject>false</cmis:canMoveObject><cmis:canDeleteContentStream>false</cmis:canDeleteContentStream><cmis:canCheckOut>false</cmis:canCheckOut><cmis:canCancelCheckOut>false</cmis:canCancelCheckOut><cmis:canCheckIn>false</cmis:canCheckIn><cmis:canSetContentStream>false</cmis:canSetContentStream><cmis:canGetAllVersions>false</cmis:canGetAllVersions><cmis:canAddObjectToFolder>false</cmis:canAddObjectToFolder><cmis:canRemoveObjectFromFolder>false</cmis:canRemoveObjectFromFolder><cmis:canGetContentStream>false</cmis:canGetContentStream><cmis:canApplyPolicy>false</cmis:canApplyPolicy><cmis:canGetAppliedPolicies>true</cmis:canGetAppliedPolicies><cmis:canRemovePolicy>false</cmis:canRemovePolicy><cmis:canGetChildren>true</cmis:canGetChildren><cmis:canCreateDocument>true</cmis:canCreateDocument><cmis:canCreateFolder>true</cmis:canCreateFolder><cmis:canCreateRelationship>true</cmis:canCreateRelationship><cmis:canDeleteTree>false</cmis:canDeleteTree><cmis:canGetRenditions>false</cmis:canGetRenditions><cmis:canGetACL>true</cmis:canGetACL><cmis:canApplyACL>true</cmis:canApplyACL></cmis:allowableActions></cmisra:object><atom:link rel="service" href="http://localhost:8080/alfresco/cmisatom/200a3d48-6a94-4cb7-b1bd-186eb6be0c4e?repositoryId=200a3d48-6a94-4cb7-b1bd-186eb6be0c4e" type="application/atomsvc+xml" /><atom:link rel="self" href="http://localhost:8080/alfresco/cmisatom/200a3d48-6a94-4cb7-b1bd-186eb6be0c4e/entry?id=workspace%3A%2F%2FSpacesStore%2F77acb21f-811c-49a3-be4d-5cc7f177f461" type="application/atom+xml;type=entry" cmisra:id="workspace://SpacesStore/77acb21f-811c-49a3-be4d-5cc7f177f461" /><atom:link rel="enclosure" href="http://localhost:8080/alfresco/cmisatom/200a3d48-6a94-4cb7-b1bd-186eb6be0c4e/entry?id=workspace%3A%2F%2FSpacesStore%2F77acb21f-811c-49a3-be4d-5cc7f177f461" type="application/atom+xml;type=entry" /><atom:link rel="edit" href="http://localhost:8080/alfresco/cmisatom/200a3d48-6a94-4cb7-b1bd-186eb6be0c4e/entry?id=workspace%3A%2F%2FSpacesStore%2F77acb21f-811c-49a3-be4d-5cc7f177f461" type="application/atom+xml;type=entry" /><atom:link rel="describedby" href="http://localhost:8080/alfresco/cmisatom/200a3d48-6a94-4cb7-b1bd-186eb6be0c4e/type?id=cmis%3Afolder" type="application/atom+xml;type=entry" /><atom:link rel="http://docs.oasis-open.org/ns/cmis/link/200908/allowableactions" href="http://localhost:8080/alfresco/cmisatom/200a3d48-6a94-4cb7-b1bd-186eb6be0c4e/allowableactions?id=workspace%3A%2F%2FSpacesStore%2F77acb21f-811c-49a3-be4d-5cc7f177f461" type="application/cmisallowableactions+xml" /><atom:link rel="down" href="http://localhost:8080/alfresco/cmisatom/200a3d48-6a94-4cb7-b1bd-186eb6be0c4e/children?id=workspace%3A%2F%2FSpacesStore%2F77acb21f-811c-49a3-be4d-5cc7f177f461" type="application/atom+xml;type=feed" /><atom:link rel="down" href="http://localhost:8080/alfresco/cmisatom/200a3d48-6a94-4cb7-b1bd-186eb6be0c4e/descendants?id=workspace%3A%2F%2FSpacesStore%2F77acb21f-811c-49a3-be4d-5cc7f177f461" type="application/cmistree+xml" /><atom:link rel="http://docs.oasis-open.org/ns/cmis/link/200908/foldertree" href="http://localhost:8080/alfresco/cmisatom/200a3d48-6a94-4cb7-b1bd-186eb6be0c4e/foldertree?id=workspace%3A%2F%2FSpacesStore%2F77acb21f-811c-49a3-be4d-5cc7f177f461" type="application/cmistree+xml" /><atom:link rel="http://docs.oasis-open.org/ns/cmis/link/200908/acl" href="http://localhost:8080/alfresco/cmisatom/200a3d48-6a94-4cb7-b1bd-186eb6be0c4e/acl?id=workspace%3A%2F%2FSpacesStore%2F77acb21f-811c-49a3-be4d-5cc7f177f461" type="application/cmisacl+xml" /><atom:link rel="http://docs.oasis-open.org/ns/cmis/link/200908/policies" href="http://localhost:8080/alfresco/cmisatom/200a3d48-6a94-4cb7-b1bd-186eb6be0c4e/policies?id=workspace%3A%2F%2FSpacesStore%2F77acb21f-811c-49a3-be4d-5cc7f177f461" type="application/atom+xml;type=feed" /><atom:link rel="http://docs.oasis-open.org/ns/cmis/link/200908/relationships" href="http://localhost:8080/alfresco/cmisatom/200a3d48-6a94-4cb7-b1bd-186eb6be0c4e/relationships?id=workspace%3A%2F%2FSpacesStore%2F77acb21f-811c-49a3-be4d-5cc7f177f461" type="application/atom+xml;type=feed" /></atom:entry>
It is valid XML.
It is a Mono bug. Mono crashes on <xsd:choice>.
See https://bugzilla.xamarin.com/show_bug.cgi?id=2907
Sub-answer:
You are using the old Alfresco CMIS URL.
Check:
http://localhost:8080/alfresco/service/cmis/index.html
I am very new to Monotouch/iOS development. I'm using
==========
MonoDevelop 2.8.8.4
Installation UUID: 0d3db625-7df9-4282-9aa6-177c25a46d07
Runtime:
Mono 2.10.9 (tarball Tue Mar 20 15:31:37 EDT 2012)
GTK 2.24.10
GTK# (2.12.0.0)
Mono for Android not installed
Apple Developer Tools:
Xcode 4.2.1 (834)
Build 4D502
Monotouch: 5.2.10 (Evaluation)
==========
I am trying to serialize object to json string using Newtonsoft 3.5 all.
Very simple code but not working.. Can anybody can please help me ...
partial void Action_Clicked (MonoTouch.Foundation.NSObject sender)
{
myDTO test = new myDTO();
string teststring = ObjToJSON(test);
}
public string ObjToJSON(myDTO oObject) //Old function name is ObjToJSON_WithWrapper
{
string sJSON = "";
sJSON = Newtonsoft.Json.JsonConvert.SerializeObject(oObject);
return sJSON;
}
public myDTO JSONToObj(String JSONString) //Old function name is JSONToObjNew
{
myDTO deseri = JsonConvert.DeserializeObject<myDTO>(JSONString);
return deseri;
}
public class myDTO
{
public myDTO()
{
}
public string StringObject {get; set;}
}
Above is my simple test code but it's giving me error when it's run Newtonsoft.Json.JsonConvert.SerializeObject(oObject);
*** ERROR***
{System.TypeLoadException: A type load exception has occurred.
at Newtonsoft.Json.Utilities.ThreadSafeStore`2[System.Type,System.Type].AddValue System.Type key) [0x00000] in <filename unknown>:0
at Newtonsoft.Json.Utilities.ThreadSafeStore`2[System.Type,System.Type].Get (System.Type key) [0x00000] in <filename unknown>:0
at Newtonsoft.Json.Serialization.JsonTypeReflector.GetAssociatedMetadataType (System.Type type) [0x00000] in <filename unknown>:0
at Newtonsoft.Json.Serialization.JsonTypeReflector.GetAttribute[JsonContainerAttribute] (System.Type type) [0x00000] in <filename unknown>:0
at Newtonsoft.Json.Serialization.JsonTypeReflector.GetAttribute[JsonContainerAttribute] (ICustomAttributeProvider attributeProvider) [0x00000] in <filename unknown>:0
at Newtonsoft.Json.Utilities.ThreadSafeStore`2[System.Reflection.ICustomAttributeProvider,Newtonsoft.Json.JsonContainerAttribute].AddValue (ICustomAttributeProvider key) [0x00000] in <filename unknown>:0
at Newtonsoft.Json.Utilities.ThreadSafeStore`2[System.Reflection.ICustomAttributeProvider,Newtonsoft.Json.JsonContainerAttribute].Get (ICustomAttributeProvider key) [0x00000] in <filename unknown>:0
at Newtonsoft.Json.Serialization.CachedAttributeGetter`1[Newtonsoft.Json.JsonContainerAttribute].GetAttribute (ICustomAttributeProvider type) [0x00000] in <filename unknown>:0
at Newtonsoft.Json.Serialization.JsonTypeReflector.GetJsonContainerAttribute (System.Type type) [0x00000] in <filename unknown>:0
at Newtonsoft.Json.Serialization.JsonTypeReflector.GetJsonObjectAttribute (System.Type type) [0x00000] in <filename unknown>:0
at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateContract (System.Type objectType) [0x00000] in <filename unknown>:0
at Newtonsoft.Json.Serialization.DefaultContractResolver.ResolveContract (System.Type type) [0x00000] in <filename unknown>:0
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.GetContractSafe (System.Object value) [0x00000] in <filename unknown>:0
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize (Newtonsoft.Json.JsonWriter jsonWriter, System.Object value) [0x00000] in <filename unknown>:0
at Newtonsoft.Json.JsonSerializer.SerializeInternal (Newtonsoft.Json.JsonWriter jsonWriter, System.Object value) [0x00000] in <filename unknown>:0
at Newtonsoft.Json.JsonSerializer.Serialize (Newtonsoft.Json.JsonWriter jsonWriter, System.Object value) [0x00000] in <filename unknown>:0
at Newtonsoft.Json.JsonConvert.SerializeObject (System.Object value, Formatting formatting, Newtonsoft.Json.JsonSerializerSettings settings) [0x00000] in <filename unknown>:0
at Newtonsoft.Json.JsonConvert.SerializeObject (System.Object value) [0x00000] in <filename unknown>:0
at JSONTest1.JSONTest1ViewController.ObjToJSON (JSONTest1.myDTO oObject) [0x00006] in /Users/developer/Projects/JSONTest1/JSONTest1/JSONTest1ViewController.cs:61
at JSONTest1.JSONTest1ViewController.Action_Clicked (MonoTouch.Foundation.NSObject sender) [0x00006] in /Users/developer/Projects/JSONTest1/JSONTest1/JSONTest1ViewController.cs:52 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) [0x00042] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:29
at JSONTest1.Application.Main (System.String[] args) [0x00000] in /Users/developer/Projects/JSONTest1/JSONTest1/Main.cs:17 }
You need this version of Newtonsoft for MonoTouch:
https://github.com/ayoung/Newtonsoft.Json