C# 具有自定义安全绑定和无效凭据的WCF服务调用中的版本生成崩溃

C# 具有自定义安全绑定和无效凭据的WCF服务调用中的版本生成崩溃,c#,wcf,xamarin,crash,xamarin.android,C#,Wcf,Xamarin,Crash,Xamarin.android,我在Xamarin.Android应用程序中实现了自定义用户名密码和WS-Security,如下所述: 在调试模式下(有或没有有效凭据),一切都很好,在发布版中也很好,直到用户提供无效凭据为止。一旦提供了无效凭据,应用程序就会崩溃,而没有任何机会防止此崩溃。以下是我在应用程序输出中看到的内容: [MonoDroid] UNHANDLED EXCEPTION: [MonoDroid] System.Xml.XmlException: Text node cannot appear in this

我在Xamarin.Android应用程序中实现了自定义用户名密码和WS-Security,如下所述:

在调试模式下(有或没有有效凭据),一切都很好,在发布版中也很好,直到用户提供无效凭据为止。一旦提供了无效凭据,应用程序就会崩溃,而没有任何机会防止此崩溃。以下是我在应用程序输出中看到的内容:

[MonoDroid] UNHANDLED EXCEPTION:
[MonoDroid] System.Xml.XmlException: Text node cannot appear in this state.  Line 1, position 1.
[MonoDroid] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x00028>
[MonoDroid] at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>m__0 (object) <0x0003f>
[MonoDroid] at Android.App.SyncContext/<Post>c__AnonStorey0.<>m__0 () <0x00027>
[MonoDroid] at Java.Lang.Thread/RunnableImplementor.Run () <0x0003f>
[MonoDroid] at Java.Lang.IRunnableInvoker.n_Run (intptr,intptr) <0x0003b>
[MonoDroid] at (wrapper dynamic-method) object.c4ebb548-a354-4444-bc7d-3e13bebb1053 (intptr,intptr) <0x0003b>
[art] JNI RegisterNativeMethods: attempt to register 0 native methods for md52ce486a14f4bcd95899665e9d932190b.JavaProxyThrowable
[AndroidRuntime] Shutting down VM
[AndroidRuntime] FATAL EXCEPTION: main
[AndroidRuntime] Process: MyApplication, PID: 32611
[AndroidRuntime] java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
[AndroidRuntime]    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)
[AndroidRuntime] Caused by: java.lang.reflect.InvocationTargetException
[AndroidRuntime]    at java.lang.reflect.Method.invoke(Native Method)
[AndroidRuntime]    at java.lang.reflect.Method.invoke(Method.java:372)
[AndroidRuntime]    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400)
[AndroidRuntime]    ... 1 more
[AndroidRuntime] Caused by: md52ce486a14f4bcd95899665e9d932190b.JavaProxyThrowable: System.Xml.XmlException: Text node cannot appear in this state.  Line 1, position 1.
[AndroidRuntime] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x00028>
[AndroidRuntime] at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>m__0 (object) <0x0003f>
[AndroidRuntime] at Android.App.SyncContext/<Post>c__AnonStorey0.<>m__0 () <0x00027>
[AndroidRuntime] at Java.Lang.Thread/RunnableImplementor.Run () <0x0003f>
[AndroidRuntime] at Java.Lang.IRunnableInvoker.n_Run (intptr,intptr) <0x0003b>
[AndroidRuntime] at (wrapper dynamic-method) object.c4ebb548-a354-4444-bc7d-3e13bebb1053 (intptr,intptr) <0x0003b>
[AndroidRuntime] 
[AndroidRuntime]    at mono.java.lang.RunnableImplementor.n_run(Native Method)
[AndroidRuntime]    at mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:29)
[AndroidRuntime]    at android.os.Handler.handleCallback(Handler.java:739)
[AndroidRuntime]    at android.os.Handler.dispatchMessage(Handler.java:95)
[AndroidRuntime]    at android.os.Looper.loop(Looper.java:145)
[AndroidRuntime]    at android.app.ActivityThread.main(ActivityThread.java:5942)
[AndroidRuntime]    ... 4 more
[Process] Sending signal. PID: 32611 SIG: 9
[MonoDroid]未处理的异常:
[MonoDroid]System.Xml.XmlException:文本节点在此状态下无法出现。第1行,位置1。
[MonoDroid]位于System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
[MonoDroid]位于System.Runtime.CompilerServices.AsyncMethodBuilderCore.m__0(对象)
[MonoDroid]位于Android.App.SyncContext/c_uanonnstorey0.m_u0()
[MonoDroid]位于Java.Lang.Thread/RunnableImplementor.Run()
[MonoDroid]在Java.Lang.IRunnableInvoker.n_运行(intptr,intptr)
[MonoDroid]at(包装器动态方法)object.c4ebb548-a354-4444-bc7d-3e13bebb1053(intptr,intptr)
[art]JNI RegisterNativeMethods:尝试为md52ce486a14f4bcd95899665e9d932190b.JavaProxyThrowable注册0个本机方法
[AndroidRuntime]正在关闭VM
[AndroidRuntime]致命异常:主
[AndroidRuntime]进程:MyApplication,PID:32611
[AndroidRuntime]java.lang.RuntimeException:java.lang.reflect.InvocationTargetException
[AndroidRuntime]位于com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)
[AndroidRuntime]由以下原因引起:java.lang.reflect.InvocationTargetException
[AndroidRuntime]位于java.lang.reflect.Method.invoke(本机方法)
[AndroidRuntime]位于java.lang.reflect.Method.invoke(Method.java:372)
[AndroidRuntime]位于com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400)
[AndroidRuntime]。。。还有一个
[AndroidRuntime]由以下原因引起:md52ce486a14f4bcd95899665e9d932190b.JavaProxyThrowable:System.Xml.XmlException:文本节点无法在此状态下出现。第1行,位置1。
[AndroidRuntime]位于System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
[AndroidRuntime]位于System.Runtime.CompilerServices.AsyncMethodBuilderCore.m_u0(对象)
[AndroidRuntime]位于Android.App.SyncContext/c_uanonnstorey0.m_u0()
[AndroidRuntime]位于Java.Lang.Thread/RunnableImplementor.Run()
[AndroidRuntime]在Java.Lang.irunableInvoker.n_运行(intptr,intptr)
[AndroidRuntime]at(包装器动态方法)object.c4ebb548-a354-4444-bc7d-3e13bebb1053(intptr,intptr)
[AndroidRuntime]
[AndroidRuntime]位于mono.java.lang.RunnableImplementor.n_run(本机方法)
[AndroidRuntime]位于mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:29)
[AndroidRuntime]位于android.os.Handler.handleCallback(Handler.java:739)
[AndroidRuntime]位于android.os.Handler.dispatchMessage(Handler.java:95)
[AndroidRuntime]位于android.os.Looper.loop(Looper.java:145)
[AndroidRuntime]位于android.app.ActivityThread.main(ActivityThread.java:5942)
[AndroidRuntime]。。。4更多
[处理]发送信号。PID:32611信号:9
我不知道它为什么会发生,以及如何修复它。我玩过链接器行为-没有成功。那么为什么会发生这种情况呢