exception in xamarin.forms in System.Net.Http - xamarin.android

I have this exception that i printed in my log that cause the app to crash in android, motorola device xt1058.
The problem is that I don't have the device and I got the log from the client who sent me the log file.
I have no idea where the logs comes from.
I have all the app wrapped in try catch but still the app crashed
09:37:10 - Error in TaskSchedulerOnUnobservedTaskException:
A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread.
09:37:11 - Error in TaskSchedulerOnUnobservedTaskException: System.AggregateException: A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread. ---> System.Net.WebException: Error: NameResolutionFailure
at System.Net.HttpWebRequest.EndGetResponse (System.IAsyncResult asyncResult) [0x00064] in <552eeeb8705c4abb9eeb5ebce43b6865>:0
at System.Threading.Tasks.TaskFactory1[TResult].FromAsyncCoreLogic (System.IAsyncResult iar, System.Func2[T,TResult] endFunction, System.Action1[T] endAction, System.Threading.Tasks.Task1[TResult] promise, System.Boolean requiresSynchronization) [0x00014] in <52ca43e23d764403a7855ae066156266>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <52ca43e23d764403a7855ae066156266>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0004e] in <52ca43e23d764403a7855ae066156266>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in <52ca43e23d764403a7855ae066156266>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in <52ca43e23d764403a7855ae066156266>:0
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <52ca43e23d764403a7855ae066156266>:0
at System.Net.Http.HttpClientHandler+<SendAsync>c__async0.MoveNext () [0x0041e] in <21d260c0947046f0aae7990757a51ba3>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <52ca43e23d764403a7855ae066156266>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0004e] in <52ca43e23d764403a7855ae066156266>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in <52ca43e23d764403a7855ae066156266>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in <52ca43e23d764403a7855ae066156266>:0
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <52ca43e23d764403a7855ae066156266>:0
at System.Net.Http.HttpClient+c__async0.MoveNext () [0x000f3] in <21d260c0947046f0aae7990757a51ba3>:0
--- End of inner exception stack trace ---
---> (Inner Exception #0) System.Net.WebException: Error: NameResolutionFailure
at System.Net.HttpWebRequest.EndGetResponse (System.IAsyncResult asyncResult) [0x00064] in <552eeeb8705c4abb9eeb5ebce43b6865>:0
at System.Threading.Tasks.TaskFactory1[TResult].FromAsyncCoreLogic (System.IAsyncResult iar, System.Func2[T,TResult] endFunction, System.Action1[T] endAction, System.Threading.Tasks.Task1[TResult] promise, System.Boolean requiresSynchronization) [0x00014] in <52ca43e23d764403a7855ae066156266>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <52ca43e23d764403a7855ae066156266>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0004e] in <52ca43e23d764403a7855ae066156266>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in <52ca43e23d764403a7855ae066156266>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in <52ca43e23d764403a7855ae066156266>:0
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <52ca43e23d764403a7855ae066156266>:0
at System.Net.Http.HttpClientHandler+<SendAsync>c__async0.MoveNext () [0x0041e] in <21d260c0947046f0aae7990757a51ba3>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <52ca43e23d764403a7855ae066156266>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0004e] in <52ca43e23d764403a7855ae066156266>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in <52ca43e23d764403a7855ae066156266>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in <52ca43e23d764403a7855ae066156266>:0
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <52ca43e23d764403a7855ae066156266>:0
at System.Net.Http.HttpClient+c__async0.MoveNext () [0x000f3] in <21d260c0947046f0aae7990757a51ba3>:0 <---

the problem is with one of the http call which leads you to this error, so cross check your API on Postman extension if it returns what you expect. check your website is running, check network status and please have a habit of surrounding these calls with try and catch.
Once you surround all your http calls with try catch put your debugger in the catch statement understand the exception and verify the same URL.

Related

getting exception "Error while connecting UiAutomation" on starting instrumentation using Runtime.getRuntime().exec

started the shell command from mainActivity.java,
Runtime.getRuntime().exec("am instrument -w com.example.android.testing.uiautomator.BasicSample.test/androidx.test.runner.AndroidJUnitRunner");
and trying to get a UiDevice object in AndroidJUnit4 class as below,
#RunWith(AndroidJUnit4.class)
#SdkSuppress(minSdkVersion = 18)
public class ChangeTextBehaviorTest {
#Before
public void startMainActivityFromHomeScreen() throws UiObjectNotFoundException,
InterruptedException {
// Initialize UiDevice instance
Instrumentation instr = InstrumentationRegistry.getInstrumentation();
mDevice = UiDevice.getInstance(instr);
}
On running the instrumantation from adb, it works fine but through shell command from mainActivity it fails with below reason,
Line 14779: 02-20 12:27:45.655 7344 7411 I TestRunner: started: testChangeText_newActivity(com.example.android.testing.uiautomator.BasicSample.ChangeTextBehaviorTest)
Line 14784: 02-20 12:27:45.667 7344 7411 E TestRunner: failed: testChangeText_newActivity(com.example.android.testing.uiautomator.BasicSample.ChangeTextBehaviorTest)
Line 14785: 02-20 12:27:45.667 7344 7411 E TestRunner: ----- begin exception -----
Line 14786: 02-20 12:27:45.669 7344 7411 E TestRunner: java.lang.RuntimeException: Error while connecting UiAutomation#f398452[id=-1, flags=0]
Line 14787: 02-20 12:27:45.669 7344 7411 E TestRunner: at android.app.UiAutomation.connect(UiAutomation.java:252)
Line 14788: 02-20 12:27:45.669 7344 7411 E TestRunner: at android.app.Instrumentation.getUiAutomation(Instrumentation.java:2182)
Line 14789: 02-20 12:27:45.669 7344 7411 E TestRunner: at androidx.test.uiautomator.UiDevice.getUiAutomation(UiDevice.java:1129)
Line 14790: 02-20 12:27:45.669 7344 7411 E TestRunner: at androidx.test.uiautomator.QueryController.<init>(QueryController.java:95)
Line 14791: 02-20 12:27:45.669 7344 7411 E TestRunner: at androidx.test.uiautomator.UiDevice.<init>(UiDevice.java:109)
Line 14792: 02-20 12:27:45.669 7344 7411 E TestRunner: at androidx.test.uiautomator.UiDevice.getInstance(UiDevice.java:261)
Line 14793: 02-20 12:27:45.669 7344 7411 E TestRunner: at com.example.android.testing.uiautomator.BasicSample.ChangeTextBehaviorTest.startMainActivityFromHomeScreen(ChangeTextBehaviorTest.java:73)
Line 14794: 02-20 12:27:45.669 7344 7411 E TestRunner: at java.lang.reflect.Method.invoke(Native Method)
Line 14795: 02-20 12:27:45.669 7344 7411 E TestRunner: at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
Line 14796: 02-20 12:27:45.669 7344 7411 E TestRunner: at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
Line 14797: 02-20 12:27:45.669 7344 7411 E TestRunner: at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
Line 14798: 02-20 12:27:45.669 7344 7411 E TestRunner: at androidx.test.internal.runner.junit4.statement.RunBefores.evaluate(RunBefores.java:76)
Line 14799: 02-20 12:27:45.669 7344 7411 E TestRunner: at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
Line 14800: 02-20 12:27:45.669 7344 7411 E TestRunner: at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
Line 14801: 02-20 12:27:45.669 7344 7411 E TestRunner: at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
Line 14802: 02-20 12:27:45.669 7344 7411 E TestRunner: at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
Line 14803: 02-20 12:27:45.669 7344 7411 E TestRunner: at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
Line 14804: 02-20 12:27:45.669 7344 7411 E TestRunner: at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
Line 14805: 02-20 12:27:45.669 7344 7411 E TestRunner: at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
Line 14806: 02-20 12:27:45.669 7344 7411 E TestRunner: at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
Line 14807: 02-20 12:27:45.669 7344 7411 E TestRunner: at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
Line 14808: 02-20 12:27:45.669 7344 7411 E TestRunner: at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
Line 14809: 02-20 12:27:45.669 7344 7411 E TestRunner: at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
Line 14810: 02-20 12:27:45.669 7344 7411 E TestRunner: at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
Line 14811: 02-20 12:27:45.669 7344 7411 E TestRunner: at androidx.test.ext.junit.runners.AndroidJUnit4.run(AndroidJUnit4.java:162)
Line 14812: 02-20 12:27:45.669 7344 7411 E TestRunner: at org.junit.runners.Suite.runChild(Suite.java:128)
Line 14813: 02-20 12:27:45.669 7344 7411 E TestRunner: at org.junit.runners.Suite.runChild(Suite.java:27)
Line 14814: 02-20 12:27:45.669 7344 7411 E TestRunner: at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
Line 14815: 02-20 12:27:45.669 7344 7411 E TestRunner: at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
Line 14816: 02-20 12:27:45.669 7344 7411 E TestRunner: at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
Line 14817: 02-20 12:27:45.669 7344 7411 E TestRunner: at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
Line 14818: 02-20 12:27:45.669 7344 7411 E TestRunner: at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
Line 14819: 02-20 12:27:45.669 7344 7411 E TestRunner: at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
Line 14820: 02-20 12:27:45.669 7344 7411 E TestRunner: at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
Line 14821: 02-20 12:27:45.669 7344 7411 E TestRunner: at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
Line 14822: 02-20 12:27:45.669 7344 7411 E TestRunner: at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
Line 14823: 02-20 12:27:45.669 7344 7411 E TestRunner: at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:56)
Line 14824: 02-20 12:27:45.669 7344 7411 E TestRunner: at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:439)
Line 14825: 02-20 12:27:45.669 7344 7411 E TestRunner: at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2211)
Line 14826: 02-20 12:27:45.669 7344 7411 E TestRunner: Caused by: android.os.DeadObjectException
Line 14827: 02-20 12:27:45.669 7344 7411 E TestRunner: at android.os.BinderProxy.transactNative(Native Method)
Line 14828: 02-20 12:27:45.669 7344 7411 E TestRunner: at android.os.BinderProxy.transact(BinderProxy.java:550)
Line 14829: 02-20 12:27:45.669 7344 7411 E TestRunner: at android.app.IUiAutomationConnection$Stub$Proxy.connect(IUiAutomationConnection.java:422)
Line 14830: 02-20 12:27:45.669 7344 7411 E TestRunner: at android.app.UiAutomation.connect(UiAutomation.java:249)
Thannk you in Advance, little help if anyone already saw this will help to get through.

no ahead of time (AOT) code was generated

I use Resources.Load read some txt file in Resources subfolders, then I use TinyCsvParser pasrse the content, it works in the editor,when build to iOS, It posts below error, Is there any advice.
Thank you!
System.AggregateException: One or more errors occurred. ---> System.ExecutionEngineException: Attempting to call method 'System.Linq.Expressions.Interpreter.LightLambda::RunVoid2<Country,System.Boolean>' for which no ahead of time (AOT) code was generated.
at System.Action`2[T1,T2].Invoke (T1 arg1, T2 arg2) [0x00000] in <00000000000000000000000000000000>:0
at TinyCsvParser.Mapping.CsvPropertyMapping`2[TEntity,TProperty].TryMapValue (TEntity entity, System.String value) [0x00000] in <00000000000000000000000000000000>:0
at TinyCsvParser.Mapping.CsvMapping`1[TEntity].Map (TinyCsvParser.Model.TokenizedRow values) [0x00000] in <00000000000000000000000000000000>:0
at System.Func`2[T,TResult].Invoke (T arg) [0x00000] in <00000000000000000000000000000000>:0
at System.Linq.Parallel.SelectQueryOperator`2+SelectQueryOperatorEnumerator`1[TInput,TOutput,TKey].MoveNext (TOutput& currentElement, TKey& currentKey) [0x00000] in <00000000000000000000000000000000>:0
at System.Linq.Parallel.OrderPreservingPipeliningSpoolingTask`2[TOutput,TKey].SpoolingWork () [0x00000] in <00000000000000000000000000000000>:0
at System.Linq.Parallel.SpoolingTaskBase.Work () [0x00000] in <00000000000000000000000000000000>:0
at System.Linq.Parallel.QueryTask.BaseWork (System.Object unused) [0x00000] in <00000000000000000000000000000000>:0
at System.Action`1[T].Invoke (T obj) [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.Tasks.Task.Execute () [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.ContextCallback.Invoke (System.Object state) [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.Tasks.Task.ExecuteWithThreadLocal (System.Threading.Tasks.Task& currentTaskSlot) [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.Tasks.Task.ExecuteEntry (System.Boolean bPreventDoubleExecution) [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00000] in <00000000000000000000000000000000>:0
unity version: 2019.4
Xcode version: 11.4

F# - Mono crashes/ returns inconsistent

I am trying to learn F# and I have some background in Standard ML. I am working through the text "Functional Approach to Programming" converting its code into F#. The code sample presented below is from the book mentioned above.
in SML
datatype 'a genTree = GenNode of 'a * ('a genTree list);;
val tree: string genTree =
GenNode("a", [GenNode("b", []),
GenNode("c", [GenNode("d", []),
GenNode("e", [])]),
GenNode("f", [])]);;
fun map f [] = []
| map f (l::ls) = (f l) :: (map f ls);;
fun foldl f e [] = e
| foldl f e (l::ls) = foldl f (f(e, l)) ls;;
fun sigma xs = foldl (op +) 0 xs;;
fun genSize (GenNode(_, ls)) =
1 + sigma (map genSize ls);;
SML> genSize tree (* returns 6: int *)
Attempt One - in F# Interactive Shell F# 3.1 (this one crashes the shell)
type genTree<'a> = GenNode of 'a * genTree<'a> list;;
let tree: string genTree =
GenNode("a", [GenNode("b", []);
GenNode("c", [GenNode("d", []);
GenNode("e", [])]);
GenNode("f", [])]);;
let rec map f ls =
match ls with
| [] -> []
| (l::ls) -> (f l) :: (map f ls);;
let rec foldl f e ls =
match ls with
| [] -> e
| (l::ls) -> foldl f (f e l) ls;;
let sigma ls = foldl ( + ) 0 ls;;
let rec genSize (GenNode(lbl, ls)) =
1 + sigma(map genSize ls);;
Attempt Two - in F# Interactive Shell F# 3.1 (give a base case for genSize, hoping that'll do the trick!)
Here is the new definition for genSize, the rest of the code from attempt #1 carries unchanged.
let rec genSize (t: genTree<'a>) =
match t with
| GenNode(_, []) -> 1
| GenNode(_, ls) -> 1 + sigma (map genSize ls);;
FSI> genSize tree = 5
Attempt Three - in MonoDevelop 5.9.4
Copy the code from Attempt 2 into MonoDevelop 5.9.4 and run it there and it correctly returns 6.
Question:
Could someone please explain to me what is causing the discrepancy between attempt 1 - 3?
Many thanks and kind regards.
PS: As I am currently learning F# and Functional Programming I tend to implement most of library functionality as a part of the learning process.
Stack track from Attempt 1
Assertion at sgen-alloc.c:460, condition `*p == NULL' not met
Stacktrace:
at <0xffffffff>
at (wrapper managed-to-native) object.__icall_wrapper_mono_object_new_specific (intptr) <0xffffffff>
at FSI_0002.DEL.sigma (Microsoft.FSharp.Collections.FSharpList1<int>) <0x00013>
at FSI_0002.DEL.genSize<a> (FSI_0002.DEL/genTree1) <0x0005f>
at FSI_0002.DEL/genSize#51.Invoke (FSI_0002.DEL/genTree1<a>) <0x00023>
at FSI_0002.DEL.map<FSI_0002.DEL/genTree1, int> (Microsoft.FSharp.Core.FSharpFunc2<FSI_0002.DEL/genTree1, int>,Microsoft.FSharp.Collections.FSharpList1<FSI_0002.DEL/genTree1>) <0x00032>
at FSI_0002.DEL.genSize (FSI_0002.DEL/genTree1<a>) <0x00056>
at <StartupCode$FSI_0004>.$FSI_0004.main# () <0x0001b>
at (wrapper runtime-invoke) object.runtime_invoke_void (object,intptr,intptr,intptr) <0xffffffff>
at <unknown> <0xffffffff>
at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&) <0xffffffff>
at System.Reflection.MonoMethod.Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo) <0x000c0>
at System.MonoType.InvokeMember (string,System.Reflection.BindingFlags,System.Reflection.Binder,object,object[],System.Reflection.ParameterModifier[],System.Globalization.CultureInfo,string[]) <0x0039a>
at System.Reflection.Emit.TypeBuilder.InvokeMember (string,System.Reflection.BindingFlags,System.Reflection.Binder,object,object[],System.Reflection.ParameterModifier[],System.Globalization.CultureInfo,string[]) <0x00066>
at System.Type.InvokeMember (string,System.Reflection.BindingFlags,System.Reflection.Binder,object,object[],System.Globalization.CultureInfo) <0x0005a>
at Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter/execEntryPtFun#1986-1.Invoke (Microsoft.FSharp.Core.Unit) <0x00083>
at Microsoft.FSharp.Compiler.Interactive.Shell/clo#883-37.Invoke (Microsoft.FSharp.Core.FSharpFunc2,Microsoft.FSharp.Collections.FSharpList`1<T>) <0x00038>
at Microsoft.FSharp.Collections.ListModule.Iterate<T> (Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Collections.FSharpList`1<T>) <0x00027>
at Microsoft.FSharp.Compiler.Interactive.Shell.arg10#882 (Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompiler,Microsoft.FSharp.Collections.FSharpList`1>>,Microsoft.FSharp.Core.Unit) <0x0005b>
at Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompiler.ProcessInputs (Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompilerState,Microsoft.FSharp.Collections.FSharpList1<Microsoft.FSharp.Compiler.Ast/ParsedInput>,bool,bool,bool,Microsoft.FSharp.Collections.FSharpList1) <0x006e3>
at Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompiler.EvalParsedDefinitions (Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompilerState,bool,bool,Microsoft.FSharp.Collections.FSharpList1<Microsoft.FSharp.Compiler.Ast/SynModuleDecl>) <0x001db>
at Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompiler.EvalParsedExpression (Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompilerState,Microsoft.FSharp.Compiler.Ast/SynExpr) <0x0005f>
at Microsoft.FSharp.Compiler.Interactive.Shell/clo#1590-45.Invoke (Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompilerState) <0x012ef>
at Microsoft.FSharp.Compiler.Interactive.Shell/FsiInteractionProcessor.InteractiveCatch<a> (Microsoft.FSharp.Core.FSharpFunc22<a, Microsoft.FSharp.Compiler.Interactive.Shell/FsiInteractionStepStatus>>,a) <0x00039>
at Microsoft.FSharp.Compiler.Interactive.Shell/FsiInteractionProcessor.ExecInteraction (bool,Microsoft.FSharp.Compiler.Build/TcConfig,Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompilerState,Microsoft.FSharp.Compiler.Ast/ParsedFsiInteraction) <0x00067>
at Microsoft.FSharp.Compiler.Interactive.Shell/FsiInteractionProcessor.ExecInteractions (bool,Microsoft.FSharp.Compiler.Build/TcConfig,Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompilerState,Microsoft.FSharp.Core.FSharpOption1) <0x005fb>
at Microsoft.FSharp.Compiler.Interactive.Shell/FsiInteractionProcessor.MainThreadProcessParsedInteraction (bool,Microsoft.FSharp.Core.FSharpOption1<Microsoft.FSharp.Compiler.Ast/ParsedFsiInteraction>,Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompilerState) <0x0013b>
at Microsoft.FSharp.Compiler.Interactive.Shell/res#1782.Invoke (Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompilerState) <0x00033>
at Microsoft.FSharp.Compiler.Interactive.Shell/runCodeOnMainThread#2021-2.Invoke (Microsoft.FSharp.Core.Unit) <0x0003b>
at <StartupCode$FSharp-Compiler-Interactive-Settings>.$Fsiaux/Microsoft-FSharp-Compiler-Interactive-IEventLoop-Invoke#47.Invoke (Microsoft.FSharp.Core.Unit) <0x0001a>
at <StartupCode$FSharp-Compiler-Interactive-Settings>.$Fsiaux/run#38-4.Invoke (Microsoft.FSharp.Core.FSharpFunc2) <0x00039>
at Microsoft.FSharp.Primitives.Basics.List.iter (Microsoft.FSharp.Core.FSharpFunc2<T, Microsoft.FSharp.Core.Unit>,Microsoft.FSharp.Collections.FSharpList1) <0x00038>
at Microsoft.FSharp.Collections.ListModule.Iterate (Microsoft.FSharp.Core.FSharpFunc2<T, Microsoft.FSharp.Core.Unit>,Microsoft.FSharp.Collections.FSharpList1) <0x00027>
at .$Fsiaux.run#35 (Microsoft.FSharp.Compiler.Interactive.SimpleEventLoop,Microsoft.FSharp.Core.Unit) <0x000d3>
at Microsoft.FSharp.Compiler.Interactive.SimpleEventLoop.Microsoft-FSharp-Compiler-Interactive-IEventLoop-Run () <0x0001f>
at Microsoft.FSharp.Compiler.Interactive.Shell.runLoop#2066 (Microsoft.FSharp.Compiler.Interactive.Shell/FsiConsoleOutput,Microsoft.FSharp.Core.Unit) <0x00205>
at Microsoft.FSharp.Compiler.Interactive.Shell.DriveFsiEventLoop (Microsoft.FSharp.Compiler.Interactive.Shell/FsiConsoleOutput) <0x0001b>
at Microsoft.FSharp.Compiler.Interactive.Shell/FsiEvaluationSession.Run () <0x00bfb>
at Microsoft.FSharp.Compiler.Interactive.Shell.evaluateSession#2382 (string[],Microsoft.FSharp.Core.Unit) <0x0009b>
at Microsoft.FSharp.Compiler.Interactive.Shell.MainMain (string[]) <0x00123>
at Microsoft.FSharp.Compiler.Interactive.Main.FsiMain (string[]) <0x00013>
at (wrapper runtime-invoke) .runtime_invoke_int_object (object,intptr,intptr,intptr) <0xffffffff>
Native stacktrace:
mono() [0x8102a23]
[0xb775240c]
[0xb7752424]
/lib/i386-linux-gnu/libc.so.6(gsignal+0x47) [0xb7545607]
/lib/i386-linux-gnu/libc.so.6(abort+0x143) [0xb7548a33]
mono() [0x827b381]
mono() [0x827b508]
mono() [0x827b5a3]
mono() [0x8233338]
mono() [0x8233a4c]
mono() [0x81f20a8]
mono(mono_object_new_alloc_specific+0x40) [0x81f6570]
mono(mono_object_new_specific+0x88) [0x81f6628]
[0xb725cc71]
[0xb25a974c]
[0xb25a9640]
[0xb25a9724]
[0xb25a96c3]
[0xb25a9637]
[0xb25a94ac]
[0xb725b5f7]
mono() [0x80723d1]
Debug info from gdb:
Could not attach to process. If your uid matches the uid of the target
process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try
again as the root user. For more details, see /etc/sysctl.d/10-ptrace.conf
ptrace: Operation not permitted.
No threads.
=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
Aborted
Looks like a Mono bug. I tested in both VS2013 and VS2015 and your code works just fine. If you can grab the stack trace I would file a bug with the Mono guys.
I get the same stack trace as you. For the record by Mono version is
Mono JIT compiler version 4.0.2 ((detached/c99aa0c Thu Jun 11 18:53:01 EDT 2015)
If you Google "Assertion at sgen-alloc.c:460, condition `*p == NULL' not met" you will see a few references to this error with Mono.
EDIT: Tested on Mono 4.0.3 and it has the same issue. Whats interesting is if you make genTree non generic like
type genTree = GenNode of string * genTree list
it works perfectly.

Error when calling ToListAsync() method of Windows Azure Mobile service using mvvmcross in Android

I am building an app with AzureMobile Services in mvvmcross when I call ToListAsync() method for retrieving data from server in Windows Phone 8 it works fine but there is an error in Xamarin.Android. Any one suggest me to resolve the issue.
Here is a full error stack
mvx:Warning: 39.64 Exception masked AggregateException:
12-02 14:06:53.317 I/mono-stdout( 2032): mvx:Warning: 39.64 Exception masked AggregateException:
at System.Threading.Tasks.Task`1[System.Collections.Generic.List`1[EmployeeDirectoryCross.Core.Models.Employee]].get_Result () [0x00000] in <filename unknown>:0
12-02 14:06:53.326 I/mono-stdout( 2032): at System.Threading.Tasks.Task`1[System.Collections.Generic.List`1[EmployeeDirectoryCross.Core.Models.Employee]].get_Result () [0x00000] in <filename unknown>:0
12-02 14:06:53.335 I/mono-stdout( 2032): at EmployeeDirectoryCross.Core.ViewModels.EmployeeListViewModel+<>c__DisplayClass2.<SearchEmployees>b__1 () [0x00001] in e:\Study\Xamarin\XamrinSamples\EmployeeDirectoryCross\EmployeeDirectoryCross.Core\ViewModels\EmployeeListViewModel.cs:54
12-02 14:06:53.335 D/Mono ( 2032): Unloading image System.dll [0x2b365118].
12-02 14:06:53.335 D/Mono ( 2032): Image addref System[0x2b354bf8] -> System.dll[0x2a6189d8]: 18
at EmployeeDirectoryCross.Core.ViewModels.EmployeeListViewModel+<>c__DisplayClass2.<SearchEmployees>b__1 () [0x00001] in e:\Study\Xamarin\XamrinSamples\EmployeeDirectoryCross\EmployeeDirectoryCross.Core\ViewModels\EmployeeListViewModel.cs:54
12-02 14:06:53.355 I/mono-stdout( 2032): at Cirrious.CrossCore.Core.MvxMainThreadDispatcher.ExceptionMaskedAction (System.Action action) [0x00000] in <filename unknown>:0
at Cirrious.CrossCore.Core.MvxMainThreadDispatcher.ExceptionMaskedAction (System.Action action) [0x00000] in <filename unknown>:0
12-02 14:06:53.355 I/mono-stdout( 2032): InnerException was MobileServiceInvalidOperationException: The server did not provide a response with the expected content.
InnerException was MobileServiceInvalidOperationException: The server did not provide a response with the expected content.
at Microsoft.WindowsAzure.MobileServices.MobileServiceHttpClient+<SendRequestAsync>d__1c.MoveNext () [0x00000] in <filename unknown>:0
12-02 14:06:53.355 I/mono-stdout( 2032): at Microsoft.WindowsAzure.MobileServices.MobileServiceHttpClient+<SendRequestAsync>d__1c.MoveNext () [0x00000] in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
12-02 14:06:53.355 I/mono-stdout( 2032): --- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0
12-02 14:06:53.365 I/mono-stdout( 2032): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0
12-02 14:06:53.365 I/mono-stdout( 2032): at System.Runtime.CompilerServices.TaskAwaiter`1[System.Net.Http.HttpResponseMessage].GetResult () [0x00000] in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter`1[System.Net.Http.HttpResponseMessage].GetResult () [0x00000] in <filename unknown>:0
12-02 14:06:53.385 I/mono-stdout( 2032): at Microsoft.WindowsAzure.MobileServices.MobileServiceHttpClient+<RequestAsync>d__4.MoveNext () [0x00000] in <filename unknown>:0

ParseKit simple example does not work and parserFromGrammer shows lots of exceptions with PEGRecognitionExceptions in console

I just came across ParseKit, and I incorporated in my IOS project using the instructions from http://parsekit.com/iphone.html. I got it from Google Code, and the checked out version is 1543.
Everything compiled and built fine.
Then I tried to use the (final working) simple example from one of the posts - Can't get simple ParseKit example working
NSString *test = #"FOO : BAR";
NSString *grammar = #"#start = foo ':' bar; foo = 'FOO'; bar = 'BAR';";
PKParser *parser = nil;
NSError *err = nil;
parser = [[PKParserFactory factory] parserFromGrammar:grammar assembler:self error:&err];
NSLog(#"parser: error1: %#", err);
[parser parse:test error:&err];
NSLog(#"parser: error2: %#", err);
- (void)didMatchFoo:(PKAssembly *)a
{
NSLog(#"FOO");
}
- (void)didMatchBar:(PKAssembly *)a
{
NSLog(#"BAR");
}
when the execution gets to the line
parser = [[PKParserFactory factory] parserFromGrammar:grammar assembler:self error:&err];
I see a lot of error messages in the console. The didMatchFoo and didMatchBar do not fire.
Here are the messages from the console:
objc[53244]: EXCEPTIONS: throwing 0xb47f040 (object 0xa17b7b0, a PEGRecognitionException)
objc[53244]: EXCEPTIONS: searching through frame [ip=0xf23ac sp=0xbfffd2e0] for exception 0xb47f020
objc[53244]: EXCEPTIONS: catch(PEGRecognitionException)
objc[53244]: EXCEPTIONS: unwinding through frame [ip=0xf23ac sp=0xbfffd2e0] for exception 0xb47f020
objc[53244]: EXCEPTIONS: handling exception 0xb47f020 at 0xf2406
objc[53244]: EXCEPTIONS: finishing handler
objc[53244]: EXCEPTIONS: throwing 0xb47f5e0 (object 0xa17b7b0, a PEGRecognitionException)
objc[53244]: EXCEPTIONS: searching through frame [ip=0xf23ac sp=0xbfffd170] for exception 0xb47f5c0
objc[53244]: EXCEPTIONS: catch(PEGRecognitionException)
objc[53244]: EXCEPTIONS: unwinding through frame [ip=0xf23ac sp=0xbfffd170] for exception 0xb47f5c0
objc[53244]: EXCEPTIONS: handling exception 0xb47f5c0 at 0xf2406
objc[53244]: EXCEPTIONS: finishing handler
objc[53244]: EXCEPTIONS: throwing 0xa589360 (object 0xa17b7b0, a PEGRecognitionException)
objc[53244]: EXCEPTIONS: searching through frame [ip=0xf23ac sp=0xbfffd230] for exception 0xa589340
objc[53244]: EXCEPTIONS: catch(PEGRecognitionException)
objc[53244]: EXCEPTIONS: unwinding through frame [ip=0xf23ac sp=0xbfffd230] for exception 0xa589340
objc[53244]: EXCEPTIONS: handling exception 0xa589340 at 0xf2406
objc[53244]: EXCEPTIONS: finishing handler
objc[53244]: EXCEPTIONS: throwing 0xa589470 (object 0xa17b7b0, a PEGRecognitionException)
objc[53244]: EXCEPTIONS: searching through frame [ip=0xf23ac sp=0xbfffd290] for exception 0xa589450
objc[53244]: EXCEPTIONS: catch(PEGRecognitionException)
objc[53244]: EXCEPTIONS: unwinding through frame [ip=0xf23ac sp=0xbfffd290] for exception 0xa589450
objc[53244]: EXCEPTIONS: handling exception 0xa589450 at 0xf2406
objc[53244]: EXCEPTIONS: finishing handler
objc[53244]: EXCEPTIONS: throwing 0xa58bd80 (object 0xa17b7b0, a PEGRecognitionException)
objc[53244]: EXCEPTIONS: searching through frame [ip=0xf23ac sp=0xbfffd380] for exception 0xa58bd60
objc[53244]: EXCEPTIONS: catch(PEGRecognitionException)
objc[53244]: EXCEPTIONS: unwinding through frame [ip=0xf23ac sp=0xbfffd380] for exception 0xa58bd60
objc[53244]: EXCEPTIONS: handling exception 0xa58bd60 at 0xf2406
objc[53244]: EXCEPTIONS: finishing handler
objc[53244]: EXCEPTIONS: throwing 0x8b848e0 (object 0xa17b7b0, a PEGRecognitionException)
objc[53244]: EXCEPTIONS: searching through frame [ip=0xf23ac sp=0xbfffd210] for exception 0x8b848c0
objc[53244]: EXCEPTIONS: catch(PEGRecognitionException)
objc[53244]: EXCEPTIONS: unwinding through frame [ip=0xf23ac sp=0xbfffd210] for exception 0x8b848c0
objc[53244]: EXCEPTIONS: handling exception 0x8b848c0 at 0xf2406
objc[53244]: EXCEPTIONS: finishing handler
objc[53244]: EXCEPTIONS: throwing 0x8ba5610 (object 0xa17b7b0, a PEGRecognitionException)
objc[53244]: EXCEPTIONS: searching through frame [ip=0xf23ac sp=0xbfffd2d0] for exception 0x8ba55f0
objc[53244]: EXCEPTIONS: catch(PEGRecognitionException)
objc[53244]: EXCEPTIONS: unwinding through frame [ip=0xf23ac sp=0xbfffd2d0] for exception 0x8ba55f0
objc[53244]: EXCEPTIONS: handling exception 0x8ba55f0 at 0xf2406
objc[53244]: EXCEPTIONS: finishing handler
objc[53244]: EXCEPTIONS: throwing 0xb57a160 (object 0xa17b7b0, a PEGRecognitionException)
objc[53244]: EXCEPTIONS: searching through frame [ip=0xf23ac sp=0xbfffd330] for exception 0xb57a140
objc[53244]: EXCEPTIONS: catch(PEGRecognitionException)
objc[53244]: EXCEPTIONS: unwinding through frame [ip=0xf23ac sp=0xbfffd330] for exception 0xb57a140
objc[53244]: EXCEPTIONS: handling exception 0xb57a140 at 0xf2406
objc[53244]: EXCEPTIONS: finishing handler
objc[53244]: EXCEPTIONS: throwing 0xb57a730 (object 0xa17b7b0, a PEGRecognitionException)
objc[53244]: EXCEPTIONS: searching through frame [ip=0xf23ac sp=0xbfffd2e0] for exception 0xb57a710
objc[53244]: EXCEPTIONS: catch(PEGRecognitionException)
objc[53244]: EXCEPTIONS: unwinding through frame [ip=0xf23ac sp=0xbfffd2e0] for exception 0xb57a710
objc[53244]: EXCEPTIONS: handling exception 0xb57a710 at 0xf2406
objc[53244]: EXCEPTIONS: finishing handler
objc[53244]: EXCEPTIONS: throwing 0xb57ac90 (object 0xa17b7b0, a PEGRecognitionException)
objc[53244]: EXCEPTIONS: searching through frame [ip=0xf23ac sp=0xbfffd170] for exception 0xb57ac70
objc[53244]: EXCEPTIONS: catch(PEGRecognitionException)
objc[53244]: EXCEPTIONS: unwinding through frame [ip=0xf23ac sp=0xbfffd170] for exception 0xb57ac70
objc[53244]: EXCEPTIONS: handling exception 0xb57ac70 at 0xf2406
objc[53244]: EXCEPTIONS: finishing handler
objc[53244]: EXCEPTIONS: throwing 0xb57af30 (object 0xa17b7b0, a PEGRecognitionException)
objc[53244]: EXCEPTIONS: searching through frame [ip=0xf23ac sp=0xbfffd230] for exception 0xb57af10
objc[53244]: EXCEPTIONS: catch(PEGRecognitionException)
objc[53244]: EXCEPTIONS: unwinding through frame [ip=0xf23ac sp=0xbfffd230] for exception 0xb57af10
objc[53244]: EXCEPTIONS: handling exception 0xb57af10 at 0xf2406
objc[53244]: EXCEPTIONS: finishing handler
objc[53244]: EXCEPTIONS: throwing 0x8ba5c40 (object 0xa17b7b0, a PEGRecognitionException)
objc[53244]: EXCEPTIONS: searching through frame [ip=0xf23ac sp=0xbfffd290] for exception 0x8ba5c20
objc[53244]: EXCEPTIONS: catch(PEGRecognitionException)
objc[53244]: EXCEPTIONS: unwinding through frame [ip=0xf23ac sp=0xbfffd290] for exception 0x8ba5c20
objc[53244]: EXCEPTIONS: handling exception 0x8ba5c20 at 0xf2406
objc[53244]: EXCEPTIONS: finishing handler
objc[53244]: EXCEPTIONS: throwing 0x8ba5f40 (object 0xa17b7b0, a PEGRecognitionException)
objc[53244]: EXCEPTIONS: searching through frame [ip=0xf23ac sp=0xbfffd380] for exception 0x8ba5f20
objc[53244]: EXCEPTIONS: catch(PEGRecognitionException)
objc[53244]: EXCEPTIONS: unwinding through frame [ip=0xf23ac sp=0xbfffd380] for exception 0x8ba5f20
objc[53244]: EXCEPTIONS: handling exception 0x8ba5f20 at 0xf2406
objc[53244]: EXCEPTIONS: finishing handler
objc[53244]: EXCEPTIONS: throwing 0x8e80b40 (object 0xa17b7b0, a PEGRecognitionException)
objc[53244]: EXCEPTIONS: searching through frame [ip=0xf23ac sp=0xbfffd210] for exception 0x8e80b20
objc[53244]: EXCEPTIONS: catch(PEGRecognitionException)
objc[53244]: EXCEPTIONS: unwinding through frame [ip=0xf23ac sp=0xbfffd210] for exception 0x8e80b20
objc[53244]: EXCEPTIONS: handling exception 0x8e80b20 at 0xf2406
objc[53244]: EXCEPTIONS: finishing handler
objc[53244]: EXCEPTIONS: throwing 0x8e4ac80 (object 0xa17b7b0, a PEGRecognitionException)
objc[53244]: EXCEPTIONS: searching through frame [ip=0xf23ac sp=0xbfffd2d0] for exception 0x8e4ac60
objc[53244]: EXCEPTIONS: catch(PEGRecognitionException)
objc[53244]: EXCEPTIONS: unwinding through frame [ip=0xf23ac sp=0xbfffd2d0] for exception 0x8e4ac60
objc[53244]: EXCEPTIONS: handling exception 0x8e4ac60 at 0xf2406
objc[53244]: EXCEPTIONS: finishing handler
objc[53244]: EXCEPTIONS: throwing 0x8ba6200 (object 0xa17b7b0, a PEGRecognitionException)
objc[53244]: EXCEPTIONS: searching through frame [ip=0xf23ac sp=0xbfffd330] for exception 0x8ba61e0
objc[53244]: EXCEPTIONS: catch(PEGRecognitionException)
objc[53244]: EXCEPTIONS: unwinding through frame [ip=0xf23ac sp=0xbfffd330] for exception 0x8ba61e0
objc[53244]: EXCEPTIONS: handling exception 0x8ba61e0 at 0xf2406
objc[53244]: EXCEPTIONS: finishing handler
objc[53244]: EXCEPTIONS: throwing 0x8ba62c0 (object 0xa17b7b0, a PEGRecognitionException)
objc[53244]: EXCEPTIONS: searching through frame [ip=0xf23ac sp=0xbfffd420] for exception 0x8ba62a0
objc[53244]: EXCEPTIONS: catch(PEGRecognitionException)
objc[53244]: EXCEPTIONS: unwinding through frame [ip=0xf23ac sp=0xbfffd420] for exception 0x8ba62a0
objc[53244]: EXCEPTIONS: handling exception 0x8ba62a0 at 0xf2406
objc[53244]: EXCEPTIONS: finishing handler
[parser parse:test error:&err];
Does not invoke callbacks, and does not return any error either.
Any pointers or help would be greatly appreciated!
PS - I uncommented some NSLOG statements in ParseKit to see what the exceptions above were:
For a grammar of
NSString *grammar = #"#start = expr; expr = abc col def; abc = 'ABC'; col = ':'; def = 'DEF';";
I got
Expected : #
Line : 1
Near : ; expr = abc
Found : =
No viable alternative found in rule 'predicate'.
Line : 1
Near : ; expr = abc col def
Found : col
No viable alternative found in rule 'predicate'.
Line : 1
Near : ; expr = abc col def
Found : def
No viable alternative found in rule 'predicate'.
Line : 1
Near : ; expr = abc col def
Found : def
No viable alternative found in rule 'predicate'.
Line : 1
Near : ; expr = abc col def ; abc
Found : ;
No viable alternative found in rule 'predicate'.
Line : 1
Near : ; expr = abc col def ; abc
Found : ;
No viable alternative found in rule 'primaryExpr'.
Line : 1
Near : ; expr = abc col def ; abc
Found : ;
Expected : |
Line : 1
Near : ; expr = abc col def ; abc
Found : ;
Expected : #
Line : 1
Near : ; expr = abc col def ; abc
Found : =
No viable alternative found in rule 'predicate'.
Line : 1
Near : ; expr = abc col def ; abc
Found : col
No viable alternative found in rule 'predicate'.
Line : 1
Near : ; expr = abc col def ; abc
Found : def
No viable alternative found in rule 'predicate'.
Line : 1
Near : ; expr = abc col def ; abc
Found : def
No viable alternative found in rule 'predicate'.
Line : 1
Near : ; expr = abc col def ; abc
Found : ;
No viable alternative found in rule 'predicate'.
Line : 1
Near : ; expr = abc col def ; abc
Found : ;
No viable alternative found in rule 'primaryExpr'.
Line : 1
Near : ; expr = abc col def ; abc
Found : ;
Expected : |
Line : 1
Near : ; expr = abc col def ; abc
Found : ;
Expected : #
Line : 1
Near : ; expr = abc col def ; abc = 'ABC'
Found : =
No viable alternative found in rule 'predicate'.
Line : 1
Near : ; expr = abc col def ; abc = 'ABC' ; col
Found : ;
No viable alternative found in rule 'primaryExpr'.
Line : 1
Near : ; expr = abc col def ; abc = 'ABC' ; col
Found : ;
Expected : |
Line : 1
Near : ; expr = abc col def ; abc = 'ABC' ; col
Found : ;
Expected : #
Line : 1
Near : ; expr = abc col def ; abc = 'ABC' ; col
Found : =
No viable alternative found in rule 'predicate'.
Line : 1
Near : ; expr = abc col def ; abc = 'ABC' ; col
Found : ;
No viable alternative found in rule 'primaryExpr'.
Line : 1
Near : ; expr = abc col def ; abc = 'ABC' ; col
Found : ;
Expected : |
Line : 1
Near : ; expr = abc col def ; abc = 'ABC' ; col
Found : ;
Expected : #
Line : 1
Near : ; expr = abc col def ; abc = 'ABC' ; col = ':'
Found : =
No viable alternative found in rule 'predicate'.
Line : 1
Near : ; expr = abc col def ; abc = 'ABC' ; col = ':' ; def
Found : ;
No viable alternative found in rule 'primaryExpr'.
Line : 1
Near : ; expr = abc col def ; abc = 'ABC' ; col = ':' ; def
Found : ;
Expected : |
Line : 1
Near : ; expr = abc col def ; abc = 'ABC' ; col = ':' ; def
Found : ;
Expected : #
Line : 1
Near : ; expr = abc col def ; abc = 'ABC' ; col = ':' ; def
Found : =
No viable alternative found in rule 'predicate'.
Line : 1
Near : ; expr = abc col def ; abc = 'ABC' ; col = ':' ; def
Found : ;
No viable alternative found in rule 'primaryExpr'.
Line : 1
Near : ; expr = abc col def ; abc = 'ABC' ; col = ':' ; def
Found : ;
Expected : |
Line : 1
Near : ; expr = abc col def ; abc = 'ABC' ; col = ':' ; def
Found : ;
Expected : #
Line : 1
Near : ; expr = abc col def ; abc = 'ABC' ; col = ':' ; def = 'DEF'
Found : =
No viable alternative found in rule 'predicate'.
Line : 1
Near : ; expr = abc col def ; abc = 'ABC' ; col = ':' ; def = 'DEF' ;
Found : ;
No viable alternative found in rule 'primaryExpr'.
Line : 1
Near : ; expr = abc col def ; abc = 'ABC' ; col = ':' ; def = 'DEF' ;
Found : ;
Expected : |
Line : 1
Near : ; expr = abc col def ; abc = 'ABC' ; col = ':' ; def = 'DEF' ;
Found : ;
Expected : #
Line : 1
Near : ; expr = abc col def ; abc = 'ABC' ; col = ':' ; def = 'DEF' ;
Found : =
No viable alternative found in rule 'predicate'.
Line : 1
Near : ; expr = abc col def ; abc = 'ABC' ; col = ':' ; def = 'DEF' ;
Found : ;
No viable alternative found in rule 'primaryExpr'.
Line : 1
Near : ; expr = abc col def ; abc = 'ABC' ; col = ':' ; def = 'DEF' ;
Found : ;
Expected : |
Line : 1
Near : ; expr = abc col def ; abc = 'ABC' ; col = ':' ; def = 'DEF' ;
Found : ;
No viable alternative found in rule 'statement'.
Line : 2147483647
Near : «EOF»
Found : «EOF»
I got it to work ... sort of!
Where things differ from the documentation ...
I linked with libParseKitMobile.a ... it was obvious since it was the only target for iOS.
I used ParserGenApp to first generate the .h and .m for my grammar
I included these generated files in my project. My project was not built with ARC, and ParseKit does, so I added -fobjc-arc to the compile flag of the generated .m
Then usage in my code was as follows:
NSString *test = #"ABC : DEF";
MyParser *parser = [[MyParser alloc] init];
NSError *err = nil;
PKAssembly *result = [parser parseString:test
assembler:self
error:&err];
if (!result) {
if (err) NSLog(#"%#", err);
} else {
NSLog(#"%#", [result description]);
}
The callback needs to be of the form:
- (void)parser:(PKParser *)p didMatchAbc:(PKAssembly *)a;
(the ParseKit documentation mentions -(void)didMatchAbc:(PKAssembly *a); but that won't work as the required signature is different)
Downloading and trying the full MiniMath project from Github helped me figure some of it out - https://github.com/itod/ParseKitMiniMathExample
MiniMath example was also available for download as a zip, but that does not seem to have the embedded ParseKit files and I had some problems with that.
Hope this helps others looking to use ParseKit in their iOS projects!
Todd Ditchendorf, thanks a lot for your work on ParseKit! Unfortunately, it is a little fragmented - Github version, Google Code version, and the documentation in the website is sparse, and interesting, has links to both Github and Google code, adding to the confusion.
parser = [[PKParserFactory factory] parserFromGrammar:grammar assembler:self error:&err];
does not seem to work. However, generating the parser code first and then using it seems to work.
It will be great if ParseKit can be cleaned up and brought up-to-date! It is a very useful tool, and all the more so because I don't see any other alternative being mentioned. If you would like help in cleaning up ParseKit and its documentation, I would be glad to help!
Cheers,
Sridhar

Resources