Entity Framework Core SaveChanges causes error on Mac - c#

I'm currently trying to build an EF core project, but when I call db.SaveChanges() I get the following error:
System.TypeInitializationException: The type initializer for 'Microsoft.Data.SqlClient.InOutOfProcHelper' threw an exception. ---> System.EntryPointNotFoundException: GetModuleHandle assembly:<unknown assembly> type:<unknown type> member:(null)
at (wrapper managed-to-native) Microsoft.Data.Common.SafeNativeMethods.GetModuleHandle(string)
at Microsoft.Data.SqlClient.InOutOfProcHelper..ctor () [0x00006] in <a1c8e16fd44948ee8c6a463f125e71f0>:0
at Microsoft.Data.SqlClient.InOutOfProcHelper..cctor () [0x00000] in <a1c8e16fd44948ee8c6a463f125e71f0>:0
--- End of inner exception stack trace ---
at Microsoft.Data.SqlClient.SqlConnectionString..ctor (System.String connectionString) [0x0000d] in <a1c8e16fd44948ee8c6a463f125e71f0>:0
at Microsoft.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions (System.String connectionString, Microsoft.Data.Common.DbConnectionOptions previous) [0x00000] in <a1c8e16fd44948ee8c6a463f125e71f0>:0
at Microsoft.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup (Microsoft.Data.Common.DbConnectionPoolKey key, Microsoft.Data.ProviderBase.DbConnectionPoolGroupOptions poolOptions, Microsoft.Data.Common.DbConnectionOptions& userConnectionOptions) [0x0003e] in <a1c8e16fd44948ee8c6a463f125e71f0>:0
at Microsoft.Data.SqlClient.SqlConnection.ConnectionString_Set (Microsoft.Data.Common.DbConnectionPoolKey key) [0x00008] in <a1c8e16fd44948ee8c6a463f125e71f0>:0
at Microsoft.Data.SqlClient.SqlConnection.set_ConnectionString (System.String value) [0x0006b] in <a1c8e16fd44948ee8c6a463f125e71f0>:0
at Microsoft.Data.SqlClient.SqlConnection..ctor (System.String connectionString, Microsoft.Data.SqlClient.SqlCredential credential) [0x00006] in <a1c8e16fd44948ee8c6a463f125e71f0>:0
at Microsoft.Data.SqlClient.SqlConnection..ctor (System.String connectionString) [0x00000] in <a1c8e16fd44948ee8c6a463f125e71f0>:0
at (wrapper remoting-invoke-with-check) Microsoft.Data.SqlClient.SqlConnection..ctor(string)
at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerConnection.CreateDbConnection () [0x00006] in <5c775909c1cf40629fd2452310cf8cc1>:0
at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.get_DbConnection () [0x0000a] in <5314a29febc14288a1bc53bf7b46d725>:0
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.CreateCommand (Microsoft.EntityFrameworkCore.Storage.RelationalCommandParameterObject parameterObject, System.Guid commandId, Microsoft.EntityFrameworkCore.Diagnostics.DbCommandMethod commandMethod) [0x0005c] in <5314a29febc14288a1bc53bf7b46d725>:0
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReader (Microsoft.EntityFrameworkCore.Storage.RelationalCommandParameterObject parameterObject) [0x00027] in <5314a29febc14288a1bc53bf7b46d725>:0
at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1+Enumerator[T].InitializeReader (Microsoft.EntityFrameworkCore.DbContext _, System.Boolean result) [0x00050] in <5314a29febc14288a1bc53bf7b46d725>:0
at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.Execute[TState,TResult] (TState state, System.Func`3[T1,T2,TResult] operation, System.Func`3[T1,T2,TResult] verifySucceeded) [0x00011] in <5c775909c1cf40629fd2452310cf8cc1>:0
at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1+Enumerator[T].MoveNext () [0x00193] in <5314a29febc14288a1bc53bf7b46d725>:0
at System.Linq.Enumerable.SingleOrDefault[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x00041] in /Users/builder/jenkins/workspace/build-package-osx-mono/2019-10/external/bockbuild/builds/mono-x64/external/corefx/src/System.Linq/src/System/Linq/Single.cs:104
at (wrapper dynamic-method) System.Object.lambda_method(System.Runtime.CompilerServices.Closure,Microsoft.EntityFrameworkCore.Query.QueryContext)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.Execute[TResult] (System.Linq.Expressions.Expression query) [0x00075] in <a3dbe48366454fdbb51dfeeb0b5c4997>:0
at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryProvider.Execute[TResult] (System.Linq.Expressions.Expression expression) [0x00000] in <a3dbe48366454fdbb51dfeeb0b5c4997>:0
at System.Linq.Queryable.FirstOrDefault[TSource] (System.Linq.IQueryable`1[T] source) [0x0000e] in /Users/builder/jenkins/workspace/build-package-osx-mono/2019-10/external/bockbuild/builds/mono-x64/external/corefx/src/System.Linq.Queryable/src/System/Linq/Queryable.cs:729
at GenericEFIAPI.RTATenantsDatabaseHelper.convertTenant (System.String tenantId, GenericEFIAPI.configObject config, GenericEFIAPI.models.TenantDatabase db) [0x002d2] in /Users/jft/projects/GenericAPI/GenericEFIAPI/RTATenantsDatabaseHelper.cs:108
at GenericEFIAPI.Program+<>c__DisplayClass1_0.<Main>b__0 (GenericEFIAPI.Program+Options o) [0x000c1] in /Users/jft/projects/GenericAPI/GenericEFIAPI/Program.cs:78
at CommandLine.ParserResultExtensions.WithParsed[T] (CommandLine.ParserResult`1[T] result, System.Action`1[T] action) [0x00011] in <68c69d6559fd42bc897efd2a474dfda9>:0
at GenericEFIAPI.Program.Main (System.String[] args) [0x00013] in /Users/jft/projects/GenericAPI/GenericEFIAPI/Program.cs:38
I've tried looking around on google for some help, but have come up empty so far... Anybody have any ideas? I'm trying to connect to sql server and using DbContextOptionsBuilder().UseSqlServer() for the underlying connection.
I'm currently getting my old windows laptop up and running to see if it is because I'm on a Mac or not, but I thought I would get this question out there in the mean time.

Alright! So I'm not 100% sure why my connection string is failing when passing it directly to the DbContextOptionsBuilder().UseSqlServer(connectionString), but if I create a SqlConnection object before that, and pass that as the parameter to UseSqlServer, it works.
So got a workaround, but not sure why the error happens when just passing the connection string.

Related

Creating a Xamarin Bindings Library for a Custom iOS Control

Xcode version - 11.1
visual studio - 8.3.3
when using the below command -
sharpie bind --output=GCCheckbox --namespace=GCCheckbox --sdk=iphoneos13.1 /Checkbox/Checkbox/Checkbox.h
......
Binding...
System.Exception: Unsupported clang availability platform: 'macCatalyst'
at Sharpie.Bind.Attributes.AvailabilityBaseAttribute+d__7.MoveNext () [0x003aa] in /Users/builder/vsts/_work/2/s/Sharpie.Bind/Attributes/AvailabilityBaseAttribute.cs:203
at System.Linq.Enumerable+SelectManySingleSelectorIterator`2[TSource,TResult].MoveNext () [0x0006f] in <3fb92ec709f44a579da6a23087df403d>:0
at Sharpie.Bind.Massagers.AvailabilityMassager.Massage (ICSharpCode.NRefactory.CSharp.EntityDeclaration entity) [0x00092] in /Users/builder/vsts/_work/2/s/Sharpie.Bind/Massagers/AvailabilityMassager.cs:55
at Sharpie.Bind.Massagers.AvailabilityMassager.VisitMethodDeclaration (ICSharpCode.NRefactory.CSharp.MethodDeclaration methodDeclaration) [0x00000] in /Users/builder/vsts/_work/2/s/Sharpie.Bind/Massagers/AvailabilityMassager.cs:35
at ICSharpCode.NRefactory.CSharp.MethodDeclaration.AcceptVisitor (ICSharpCode.NRefactory.CSharp.IAstVisitor visitor) [0x00000] in :0
at ICSharpCode.NRefactory.CSharp.DepthFirstAstVisitor.VisitChildren (ICSharpCode.NRefactory.CSharp.AstNode node) [0x00010] in :0
at ICSharpCode.NRefactory.CSharp.DepthFirstAstVisitor.VisitTypeDeclaration (ICSharpCode.NRefactory.CSharp.TypeDeclaration typeDeclaration) [0x00000] in :0
at Sharpie.Bind.Massagers.AvailabilityMassager.VisitTypeDeclaration (ICSharpCode.NRefactory.CSharp.TypeDeclaration typeDeclaration) [0x00006] in /Users/builder/vsts/_work/2/s/Sharpie.Bind/Massagers/AvailabilityMassager.cs:24
at ICSharpCode.NRefactory.CSharp.TypeDeclaration.AcceptVisitor (ICSharpCode.NRefactory.CSharp.IAstVisitor visitor) [0x00000] in :0
at ICSharpCode.NRefactory.CSharp.DepthFirstAstVisitor.VisitChildren (ICSharpCode.NRefactory.CSharp.AstNode node) [0x00010] in :0
at ICSharpCode.NRefactory.CSharp.DepthFirstAstVisitor.VisitSyntaxTree (ICSharpCode.NRefactory.CSharp.SyntaxTree syntaxTree) [0x00000] in :0
at Sharpie.Bind.DocumentSyntaxTree.AcceptVisitor (ICSharpCode.NRefactory.CSharp.IAstVisitor visitor) [0x00015] in /Users/builder/vsts/_work/2/s/Sharpie.Bind/DocumentSyntaxTree.cs:37
at Sharpie.Bind.BindingMassager.Massage (ICSharpCode.NRefactory.CSharp.AstNode astNode, Sharpie.Bind.BindingTarget bindingTarget) [0x00033] in /Users/builder/vsts/_work/2/s/Sharpie.Bind/BindingMassager.cs:136
at Sharpie.Bind.BindingFrontend.Bind (Clang.Ast.Decl decl) [0x0010d] in /Users/builder/vsts/_work/2/s/Sharpie.Bind/BindingFrontend.cs:93
at Sharpie.BindTool.HandleTranslationUnit (Clang.Ast.TranslationUnitDecl decl) [0x0018d] in /Users/builder/vsts/_work/2/s/Sharpie/BindTool.cs:166
at Clang.Driver.HandleTranslationUnit (Clang.Ast.TranslationUnitDecl translationUnit) [0x00000] in /Users/builder/vsts/_work/2/s/Clang/Driver.cs:158
at Clang.Driver.HandleTranslationUnit (System.IntPtr translationUnit) [0x00000] in /Users/builder/vsts/_work/2/s/Clang/Driver.cs:148
at (wrapper managed-to-native) Clang.Driver:RunInternal (Clang.Driver,string[],string,Clang.Frontend.DiagnosticConsumer)
at Clang.Driver.Run (System.String[] inputFiles, System.String[] clangArgs, Clang.Frontend.DiagnosticConsumer diagnosticConsumer) [0x00177] in /Users/builder/vsts/_work/2/s/Clang/Driver.cs:139
at Sharpie.ParseTool.Run () [0x005c8] in /Users/builder/vsts/_work/2/s/Sharpie/ParseTool.cs:581
at Sharpie.BindTool.CoreRun () [0x00001] in /Users/builder/vsts/_work/2/s/Sharpie/BindTool.cs:117
at Sharpie.BindTool.Run () [0x00026] in /Users/builder/vsts/_work/2/s/Sharpie/BindTool.cs:95
Done. Exiting with error code 1.

C# Google OAUTH2 using OWIN on Mono results in "System.Web.HttpException (0x80004005): headers have already been sent"

I've followed a number of tutorials for adding google OAUTH2 authentication to an existing MVC project, but I end up with the same issue involving a 404 to the client and the following trace generated:
System.Web.HttpException (0x80004005): headers have already been sent
at System.Web.HttpResponse.set_StatusCode (System.Int32 value) [0x00012] in <d31574f4ab6745f49b1626160268508f>:0
at System.Web.HttpResponseWrapper.set_StatusCode (System.Int32 value) [0x00000] in <d31574f4ab6745f49b1626160268508f>:0
at Microsoft.Owin.Host.SystemWeb.OwinCallContext.Microsoft.Owin.Host.SystemWeb.CallEnvironment.AspNetDictionary.IPropertySource.SetResponseStatusCode (System.Int32 value) [0x00000] in <90ddfcf805444e2e8c4aafed95112b04>:0
at Microsoft.Owin.Host.SystemWeb.CallEnvironment.AspNetDictionary.set_ResponseStatusCode (System.Int32 value) [0x00000] in <90ddfcf805444e2e8c4aafed95112b04>:0
at Microsoft.Owin.Host.SystemWeb.CallEnvironment.AspNetDictionary.PropertiesTrySetValue (System.String key, System.Object value) [0x00257] in <90ddfcf805444e2e8c4aafed95112b04>:0
at Microsoft.Owin.Host.SystemWeb.CallEnvironment.AspNetDictionary.System.Collections.Generic.IDictionary<System.String,System.Object>.set_Item (System.String key, System.Object value) [0x00000] in <90ddfcf805444e2e8c4aafed95112b04>:0
at Microsoft.Owin.OwinResponse.Set[T] (System.String key, T value) [0x00006] in <0850b9daadb8416ca216d3d37f3983d1>:0
at Microsoft.Owin.OwinResponse.set_StatusCode (System.Int32 value) [0x00000] in <0850b9daadb8416ca216d3d37f3983d1>:0
at Microsoft.Owin.OwinResponse.Redirect (System.String location) [0x00000] in <0850b9daadb8416ca216d3d37f3983d1>:0
at Microsoft.Owin.Security.Google.GoogleOAuth2AuthenticationHandler.InvokeReplyPathAsync () [0x002c9] in <dcea7978bc3a4441882e0efa5daced72>:0
at Microsoft.Owin.Security.Google.GoogleOAuth2AuthenticationHandler.InvokeAsync () [0x00068] in <dcea7978bc3a4441882e0efa5daced72>:0
at Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware`1[TOptions].Invoke (Microsoft.Owin.IOwinContext context) [0x00109] in <1cc66b39b04f4b919683032a3a12cc4f>:0
at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContextStage.RunApp (System.Func`2[T,TResult] entryPoint, System.Collections.Generic.IDictionary`2[TKey,TValue] environment, System.Threading.Tasks.TaskCompletionSource`1[TResult] tcs, Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.StageAsyncResult result) [0x0007e] in <90ddfcf805444e2e8c4aafed95112b04>:0
at Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware`1[TOptions].Invoke (Microsoft.Owin.IOwinContext context) [0x00183] in <1cc66b39b04f4b919683032a3a12cc4f>:0
at Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware`1[TOptions].Invoke (Microsoft.Owin.IOwinContext context) [0x00183] in <1cc66b39b04f4b919683032a3a12cc4f>:0
at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContextStage.RunApp (System.Func`2[T,TResult] entryPoint, System.Collections.Generic.IDictionary`2[TKey,TValue] environment, System.Threading.Tasks.TaskCompletionSource`1[TResult] tcs, Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.StageAsyncResult result) [0x0007e] in <90ddfcf805444e2e8c4aafed95112b04>:0
at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContext.DoFinalWork (Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.StageAsyncResult result) [0x0007d] in <90ddfcf805444e2e8c4aafed95112b04>:0
at Microsoft.Owin.Host.SystemWeb.Infrastructure.ErrorState.Rethrow () [0x00000] in <90ddfcf805444e2e8c4aafed95112b04>:0
at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.StageAsyncResult.End (System.IAsyncResult ar) [0x0001d] in <90ddfcf805444e2e8c4aafed95112b04>:0
at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContext.EndFinalWork (System.IAsyncResult ar) [0x00006] in <90ddfcf805444e2e8c4aafed95112b04>:0
at System.Web.AsyncInvoker.<doAsyncCallback>b__8_0 (System.Object ores) [0x00007] in <d31574f4ab6745f49b1626160268508f>:0
I am using mono on linux, and I'm guessing it has something to do with the system web.config or routing. I've seen similar questions/answers but nothing I've read relates to this exact error. Is there a module I need to unregister or some other option that could be causing this?

MvvmCross Failed to construct and initialize ViewModel for type

I am trying to create a mobile application using MvvmCross v.4.4.0.
Application works correct. But if collapse application and lock the phone, and then unlock and press "Overview" android button application crash (only on the Xiaomi phone).
I think android kills activity and then unsuccessfully trying to recreate it.
Could you, please explain me, what I do wrong? How to fix it?
Stacktrace:
Android.Runtime.RaiseThrowableEventArgs MvvmCross.Platform.Exceptions.MvxException: Failed to construct and initialize ViewModel for type Test.Core.ViewModels.MainMenuViewModel from locator MvxDefaultViewModelLocator - check InnerException for more information ---> MvvmCross.Platform.Exceptions.MvxException: Problem creating viewModel of type MainMenuViewModel ---> MvvmCross.Platform.Exceptions.MvxIoCResolveException: Failed to construct MainMenuViewModel ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Java.Lang.LinkageError: no static method "Landroid/text/Html;.fromHtml(Ljava/lang/String;I)Landroid/text/Spanned;" at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw ()
[0x0000c] in <89dd20b27a0b473a848558c84f1f086a>:0 at Java.Interop.JniEnvironment+StaticMethods.GetStaticMethodID (Java.Interop.JniObjectReference type, System.String name, System.String signature)
[0x00068] in :0 at Java.Interop.JniType.GetStaticMethod (System.String name, System.String signature)
[0x0000d] in :0 at Java.Interop.JniPeerMembers+JniStaticMethods.GetMethodInfo (System.String encodedMember)
[0x0003c] in :0 at Java.Interop.JniPeerMembers+JniStaticMethods.InvokeObjectMethod (System.String encodedMember, Java.Interop.JniArgumentValue* parameters)
[0x00001] in :0 at Android.Text.Html.FromHtml (System.String source, Android.Text.FromHtmlOptions flags)
[0x0003b] in :0 at Test.Droid.Providers.DialogProvider.ShowSnackbar () [0x00017] in <0fa1f44ee2f748fe816e790571c2153b>:0 at Test.Core.ViewModels.BaseViewModel..ctor ()
[0x0006d] in :0 at Test.Core.ViewModels.MainMenuViewModel..ctor (Test.Core.Managers.IExceptionManager exceptionManager)
[0x0000b] in :0 at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&) at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters)
[0x00002] in <89dd20b27a0b473a848558c84f1f086a>:0 --- End of inner exception stack trace --- at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters)
[0x0001c] in <89dd20b27a0b473a848558c84f1f086a>:0 at System.Reflection.MonoCMethod.DoInvoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture)
[0x00089] in <89dd20b27a0b473a848558c84f1f086a>:0 at System.Reflection.MonoCMethod.Invoke (System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture)
[0x00000] in <89dd20b27a0b473a848558c84f1f086a>:0 at System.Reflection.ConstructorInfo.Invoke (System.Object[] parameters)
[0x00000] in <89dd20b27a0b473a848558c84f1f086a>:0 at MvvmCross.Platform.IoC.MvxSimpleIoCContainer.IoCConstruct (System.Type type)
[0x0003a] in <4ddde23419c5494288c799fcdbb0f189>:0 --- End of inner exception stack trace --- at MvvmCross.Platform.IoC.MvxSimpleIoCContainer.IoCConstruct (System.Type type)
[0x0005b] in <4ddde23419c5494288c799fcdbb0f189>:0 at MvvmCross.Platform.Mvx.IocConstruct (System.Type t)
[0x00005] in <4ddde23419c5494288c799fcdbb0f189>:0 at MvvmCross.Core.ViewModels.MvxDefaultViewModelLocator.Load (System.Type viewModelType, MvvmCross.Core.ViewModels.IMvxBundle parameterValues, MvvmCross.Core.ViewModels.IMvxBundle savedState)
[0x00000] in <69bce0378e8e413982d3b552d7e387a8>:0 --- End of inner exception stack trace --- at MvvmCross.Core.ViewModels.MvxDefaultViewModelLocator.Load (System.Type viewModelType, MvvmCross.Core.ViewModels.IMvxBundle parameterValues, MvvmCross.Core.ViewModels.IMvxBundle savedState)
[0x00027] in <69bce0378e8e413982d3b552d7e387a8>:0 at MvvmCross.Core.ViewModels.MvxViewModelLoader.LoadViewModel (MvvmCross.Core.ViewModels.MvxViewModelRequest request, MvvmCross.Core.ViewModels.IMvxBundle savedState, MvvmCross.Core.ViewModels.IMvxViewModelLocator viewModelLocator)
[0x00015] in <69bce0378e8e413982d3b552d7e387a8>:0 --- End of inner exception stack trace --- at MvvmCross.Core.ViewModels.MvxViewModelLoader.LoadViewModel (MvvmCross.Core.ViewModels.MvxViewModelRequest request, MvvmCross.Core.ViewModels.IMvxBundle savedState, MvvmCross.Core.ViewModels.IMvxViewModelLocator viewModelLocator)
[0x00046] in <69bce0378e8e413982d3b552d7e387a8>:0 at MvvmCross.Core.ViewModels.MvxViewModelLoader.LoadViewModel (MvvmCross.Core.ViewModels.MvxViewModelRequest request, MvvmCross.Core.ViewModels.IMvxBundle savedState)
[0x00020] in <69bce0378e8e413982d3b552d7e387a8>:0 at MvvmCross.Droid.Views.MvxAndroidViewsContainer.ViewModelFromRequest (MvvmCross.Core.ViewModels.MvxViewModelRequest viewModelRequest, MvvmCross.Core.ViewModels.IMvxBundle savedState)
[0x00005] in :0 at MvvmCross.Droid.Views.MvxAndroidViewsContainer.CreateViewModelFromIntent (Android.Content.Intent intent, MvvmCross.Core.ViewModels.IMvxBundle savedState)
[0x00027] in :0 at MvvmCross.Droid.Views.MvxAndroidViewsContainer.Load (Android.Content.Intent intent, MvvmCross.Core.ViewModels.IMvxBundle savedState, System.Type viewModelTypeHint)
[0x00089] in :0 at MvvmCross.Droid.Views.MvxActivityViewExtensions.LoadViewModel (MvvmCross.Droid.Views.IMvxAndroidView androidView, MvvmCross.Core.ViewModels.IMvxBundle savedState)
[0x0006a] in :0 at MvvmCross.Droid.Views.MvxActivityViewExtensions+<>c__DisplayClass1_0.b__1 ()
[0x0000a] in :0 at MvvmCross.Core.Views.MvxViewExtensionMethods.OnViewCreate (MvvmCross.Core.Views.IMvxView view, System.Func`1[TResult] viewModelLoader)
[0x00012] in <69bce0378e8e413982d3b552d7e387a8>:0 at MvvmCross.Droid.Views.MvxActivityViewExtensions.OnViewCreate (MvvmCross.Droid.Views.IMvxAndroidView androidView, Android.OS.Bundle bundle)
[0x00062] in :0 at MvvmCross.Droid.Views.MvxActivityAdapter.EventSourceOnCreateCalled (System.Object sender, MvvmCross.Platform.Core.MvxValueEventArgs`1[T] eventArgs)
[0x0000c] in :0 at (wrapper delegate-invoke) System.EventHandler`1[MvvmCross.Platform.Core.MvxValueEventArgs`1[Android.OS.Bundle]]:invoke_void_object_TEventArgs (object,MvvmCross.Platform.Core.MvxValueEventArgs`1) at MvvmCross.Platform.Core.MvxDelegateExtensionMethods.Raise[T] (System.EventHandler`1[TEventArgs] eventHandler, System.Object sender, T value)
[0x0000b] in <4ddde23419c5494288c799fcdbb0f189>:0 at MvvmCross.Platform.Droid.Views.MvxEventSourceActivity.OnCreate (Android.OS.Bundle bundle)
[0x00014] in <4230cf00b647458f9b3e211590e6cc9d>:0 at Test.Droid.Views.BaseView`1[TViewModel].OnCreate (Android.OS.Bundle bundle)
[0x00000] in <0fa1f44ee2f748fe816e790571c2153b>:0 at Test.Droid.Views.MainMenuView.OnCreate (Android.OS.Bundle bundle)
[0x00000] in <0fa1f44ee2f748fe816e790571c2153b>:0 at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_savedInstanceState)
[0x00011] in :0 at (wrapper dynamic-method) System.Object:e6d6ef29-3746-4c8e-b037-c64f6dfe49f0 (intptr,intptr,intptr)
This is a linking issue. You have some kind of DialogProvider, which uses the Android.Text.Html.FromHtml method, which seems to be stripped out.
You can add expressions to LinkerPleaseInclude.cs to prevent the linker from removing code or you can add [Preserve(AllMembers = true)] attribute on your DialogProvider class.

Content view content update app crashes in xamarin iOS

I create the xamarin form project and update the content view content multiple time.
Its correctly update for android. But it not work for iOS
I have update the Contentview content when click the button like that
contentView.content = mVview;
Please find the stack trace
wrapper managed-to-native
at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/src/UIKit/UIApplication.cs:79
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName,`/lanes/3969/7beaef43/source/xamarin-macios/src/UIKi1
when i put try catch, i got this stack trace
at Xamarin.Forms.Platform.iOS.EditorRenderer.Dispose (System.Boolean disposing) [0x00003] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\Renderers\EditorRenderer.cs:28
at Foundation.NSObject.Dispose () [0x00000] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/src/Foundation/NSObject2.cs:133
at Xamarin.Forms.Platform.iOS.ListViewRenderer.Dispose (System.Boolean disposing) [0x001c4] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\Renderers\ListViewRenderer.cs:153
at Foundation.NSObject.Dispose () [0x00000] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/src/Foundation/NSObject2.cs:133
at Xamarin.Forms.Platform.iOS.Platform.DisposeModelAndChildrenRenderers (Xamarin.Forms.Element view) [0x00038] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\Platform.cs:322
at Xamarin.Forms.Platform.iOS.Platform.HandleChildRemoved (System.Object sender, Xamarin.Forms.ElementEventArgs e) [0x00007] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\Platform.cs:433
at Xamarin.Forms.Element.OnDescendantRemoved (Xamarin.Forms.Element child) [0x00008] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\Element.cs:600
at Xamarin.Forms.Element.OnDescendantRemoved (Xamarin.Forms.Element child) [0x00022] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\Element.cs:603
at Xamarin.Forms.Element.OnDescendantRemoved (Xamarin.Forms.Element child) [0x00022] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\Element.cs:603
at Xamarin.Forms.Element.OnChildRemoved (Xamarin.Forms.Element child) [0x00021] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\Element.cs:367
at Xamarin.Forms.VisualElement.OnChildRemoved (Xamarin.Forms.Element child) [0x00000] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\VisualElement.cs:578
at Xamarin.Forms.Layout.OnInternalRemoved (Xamarin.Forms.View view) [0x00012] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\Layout.cs:413
at Xamarin.Forms.Layout.InternalChildrenOnCollectionChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x0002f] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\Layout.cs:377
at System.Collections.ObjectModel.ObservableCollection`1[T].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00012] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/System/compmod/system/collections/objectmodel/observablecollection.cs:288
at System.Collections.ObjectModel.ObservableCollection`1[T].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedAction action, System.Object item, System.Int32 index) [0x00000] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/System/compmod/system/collections/objectmodel/observablecollection.cs:351
at System.Collections.ObjectModel.ObservableCollection`1[T].RemoveItem (System.Int32 index) [0x0002b] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/System/compmod/system/collections/objectmodel/observablecollection.cs:205
at System.Collections.ObjectModel.Collection`1[T].Remove (T item) [0x0002d] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/collections/objectmodel/collection.cs:113
at Xamarin.Forms.TemplateUtilities.OnContentChanged (Xamarin.Forms.BindableObject bindable, System.Object oldValue, System.Object newValue) [0x0001a] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\TemplateUtilities.cs:63
at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.BindableObject+SetValueFlags attributes, System.Boolean silent) [0x00108] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindableObject.cs:584
at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.BindableObject+SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x0014b] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindableObject.cs:378
at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value, System.Boolean fromStyle, System.Boolean checkAccess) [0x0005f] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindableObject.cs:531
at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value) [0x00000] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindableObject.cs:83
at Xamarin.Forms.ContentView.set_Content (Xamarin.Forms.View value) [0x00000] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\ContentView.cs:11
at EgnatiumFull.Pages.QuestionAnswerPage.UpdateTheQuestionLayout () [0x00144] in /Volumes/MS/prjects/Egnatium/EgnatiumFinal/EgnatiumFinal/EgnatiumFinal/Pages/QuestionAnswerPage.cs:539
at EgnatiumFull.Pages.QuestionAnswerPage+<OnAppearing>c__async1.MoveNext () [0x0007e] in /Volumes/MS/prjects/Egnatium/EgnatiumFinal/EgnatiumFinal/EgnatiumFinal/Pages/QuestionAnswerPage.cs:383
--- End of stack trace from previous location where exception was thrown ---
at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/src/UIKit/UIApplication.cs:79
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/src/UIKit/UIApplication.cs:63
at EgnatiumFinal.iOS.Application.Main (System.String[] args) [0x00008] in /Users/saifamily/Documents/14_2_17/EgnatiumFinal/EgnatiumFinal/EgnatiumFinal.iOS/Main.cs:17 xa
Finally I found the solution in my own way, i think i don't know is this correct way but in my case it work perfectly
I rendererd the list view for ios and overide the methods dispose with try/catch statement
protected override void Dispose()
{
try{
base.Dispose();
}
Catch(Exception ex)
{
return;
}
}

unrecognized token: "'"Alliance Française""

Trying to query a sqlite database table using the following query:
select * from contact where FullName='Alliance Française'
I am getting the following error:
unrecognized token: "'Alliance Française"
Stack Trace:
at SQLite.Net.Platform.XamarinAndroid.SQLiteApiAndroid.Prepare2 (SQLite.Net.Interop.IDbHandle db, System.String query) [0x00037] in <8dbf6ff85082469fb9d4dfaa9eae6b69>:0
at SQLite.Net.SQLiteCommand.Prepare () [0x0001c] in <8f2bb39aeff94a30a8628064be9c7efe>:0
at SQLite.Net.SQLiteCommand+<ExecuteDeferredQuery>d__15`1[T].MoveNext () [0x0003f] in <8f2bb39aeff94a30a8628064be9c7efe>:0
at System.Collections.Generic.List`1[T]..ctor (System.Collections.Generic.IEnumerable`1[T] collection) [0x0008b] in /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mcs/class/referencesource/mscorlib/system/collections/generic/list.cs:99
at System.Linq.Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x00011] in /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mcs/class/referencesource/System.Core/System/Linq/Enumerable.cs:861
at SQLite.Net.SQLiteCommand.ExecuteQuery[T] () [0x0001c] in <8f2bb39aeff94a30a8628064be9c7efe>:0
at SQLite.Net.SQLiteConnection.Query[T] (System.String query, System.Object[] args) [0x00008] in <8f2bb39aeff94a30a8628064be9c7efe>:0
at Prototype.Core.CRUDRepository`1[T].GetByQuery (System.String query, SQLite.Net.SQLiteConnection dbConnection) [0x00002] in C:\C# Projects\Apps Dev\Your Messengar App\ServerApps\Prototype\MessagePrototype\Prototype.Core\CRUDRepository.cs:163
Not sure how to proceed.
Regards,
Will
Solved it by using
dbConnection.Query(query, selectionArgs)

Categories