Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all 204402 articles
Browse latest View live

The "SelectedItem" of a "ListView" in Xamarin.Forms should have a settable Background Color!!!

$
0
0

The Xamarin.Forms.ListView should have a property named "SelectedItemBackgroundColor". Actually, as I write this, it should probably have a "SelectedItemTemplate" property in the next release of Xamarin.Forms (hint, hint).
So that the programmer can set a background color at minimum for the SelectedItem and make it stand out from all the other items in the list in any other way the programmer wants it to stand out.
As of right now, I simply wanted to give some visual clue that the "SelectedItem" in the ListView is, in fact, selected. This is not even working for whatever reason. It maybe because I have a "Clicked" event handler set up on a StackLayout which immediately takes the user to another page. But even when I pop the page and come back to the underlying page, the SelectedItem does not refresh itself in the ListView. So, I think there is some good work to be done.

In the meantime, I welcome all suggestions on how to get this to work the right way. I guess I could manually go through the ListView and find the SelectedItem and set the background color myself? This really should be handled by the control itself.


How can I disable animation on a switch when the state changes.

$
0
0

I need to cancel the animation to a switch when its on / off state changes, I have a list with reusable cells and this animation does not look good when you scroll.

Dont Bulid Another Dll In Release Folder

$
0
0

Hi,
i want release my project
first change debug to release and bulid & run project but in App.Android/bin/release just create this dll and apk file its not installed in phone

whats problem ? how to get apk file for install in phone

Xamarin.Android - Java Native Invoke (JNI)

$
0
0

In this tutorial how one can integrate google map in java file

Does the "ListView" have a double-click event handler for a ListItem?

$
0
0

I'm having a very difficult time understanding how to define and use click/tap event handlers for a ListView control. Are clicks/taps the same thing? Or are they distinct? It looks like you can setup a tap event handler and define the number of taps to trigger the event. So, we can set up double-tap event handlers. But where's the equivalent double-click for a mouse?

Somebody please explain whether clicks/taps are the same and if not, why isn't there a double-click event handler for the double-clicked ListItem's in a ListView?

Also, it seems like setting GestureRecognizers on a control actually breaks the click-event handlers. I'm not 100% sure what's going on but this is the impression I'm getting from my code testing.

Oh, and lastly, before I forget. It seems like a single "tap" event handler will not properly highlight the tapped ListView Item when it occurs. Is this control in this much need of a rewrite or am I just completely lost?

Does MVVMLight support Xamarin Mac

$
0
0

Hi,
Just wanted to ask if anyone is using the MVVMLight framework with Xamarin Mac, we use Prism on WPF and are now porting
our app to MacOS. Are there any issues with it? So far from researching online it seems to be targeted at WPF and Mobile platforms not much
about MacOS support mentioned.

Thanks

how to change HorizontalOptions in Code

$
0
0

hello everyone,

So i want to change a Image_HorizontalOption depending on the Device that is using the app.

so i wrote this

        if (Device.Idiom == TargetIdiom.Tablet)
        {
            HeaderImg.HorizontalOptions = // ???
        }
        else if (Device.Idiom == TargetIdiom.Phone)
        {
            HeaderImg.Aspect = Aspect.AspectFit;
        }

The part with Image.Aspect is working good, but i can't figure out how to change the HorizontalOptions of an Image.
can you please Help me !?

Xamarin.iOS application freezes on iOS 13

$
0
0

I have Xamarin Native (iOS/Android) application. The application works without problems on iOS 12 and below. If you run the application on the device with iOS 13, then it starts to freeze for unknown reasons and this bug doesn't have clear steps to reproduce, it occurs on different screens.

This is stacktrace from Visual Studio for Mac

=================================================================
    Native Crash Reporting
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================

=================================================================
    Native stacktrace:
=================================================================
    0x1003ea775 - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : mono_dump_native_crash_info
    0x1003de6b5 - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : mono_handle_native_crash
    0x1003f19f1 - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : mono_sigsegv_signal_handler_debug
    0x10790bb1d - /usr/lib/system/libsystem_platform.dylib : _sigtramp
    0x111ab5e38 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : OBJC_CLASS_$_UIView
    0x122711c6b - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/VectorKit.framework/VectorKit : _ZNSt3__110shared_ptrIN3ggl6BufferEED2Ev
    0x1227397f3 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/VectorKit.framework/VectorKit : _ZNSt3__110shared_ptrIN3ggl12ConstantDataEED2Ev
    0x122c98778 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/VectorKit.framework/VectorKit : _ZNSt3__113__vector_baseIN3ggl19ConstantDataElementEN3geo12StdAllocatorIS2_NS1_9AllocatorEEEED2Ev
    0x122c9850c - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/VectorKit.framework/VectorKit : _ZN3ggl13PipelineSetupD2Ev
    0x1227b3d24 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/VectorKit.framework/VectorKit : _ZN3ggl6Circle17FillPipelineSetupD0Ev
    0x122b3059d - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/VectorKit.framework/VectorKit : _ZNSt3__120__shared_ptr_emplaceIN2md23CircleOverlayRenderableENS_9allocatorIS2_EEE16__on_zero_sharedEv
    0x12281c40b - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/VectorKit.framework/VectorKit : _ZNSt3__110shared_ptrIN2md23CircleOverlayRenderableEED2Ev
    0x1068eff02 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc.A.dylib : _ZL27object_cxxDestructFromClassP11objc_objectP10objc_class
    0x1068ff3c9 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc.A.dylib : objc_destructInstance
    0x10690598f - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc.A.dylib : -[NSObject dealloc]
    0x122b2eb22 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/VectorKit.framework/VectorKit : -[VKVectorOverlayCircle dealloc]
    0x106906116 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc.A.dylib : _ZN11objc_object17sidetable_releaseEb
    0x1068eff02 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc.A.dylib : _ZL27object_cxxDestructFromClassP11objc_objectP10objc_class
    0x1068ff3c9 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc.A.dylib : objc_destructInstance
    0x10690598f - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc.A.dylib : -[NSObject dealloc]
    0x101d63e52 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/MapKit.framework/MapKit : -[MKOverlayRenderer dealloc]
    0x101d63d9b - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/MapKit.framework/MapKit : -[MKOverlayPathRenderer dealloc]
    0x106906116 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc.A.dylib : _ZN11objc_object17sidetable_releaseEb
    0x100640abd - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : xamarin_release_managed_ref
    0x12a596bbc - Unknown
    0x132b427b9 - Unknown
    0x1003f4dd5 - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : mono_jit_runtime_invoke
    0x1005210e7 - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : mono_runtime_invoke_checked
    0x100524a6e - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : mono_runtime_invoke
    0x10064a822 - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : xamarin_invoke_trampoline
    0x10065257b - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : xamarin_arch_trampoline
    0x100653782 - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : xamarin_x86_64_common_trampoline
    0x100dd0d10 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Foundation.framework/Foundation : __NSThreadPerformPerform
    0x105b2e271 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation : _CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION_
    0x105b2e19c - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation : __CFRunLoopDoSource0
    0x105b2d974 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation : __CFRunLoopDoSources0
    0x105b2867f - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation : __CFRunLoopRun
    0x105b27e66 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation : CFRunLoopRunSpecific
    0x10ca74bb0 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices : GSEventRunModal
    0x110d41dd0 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : UIApplicationMain
    0x12a4abae2 - Unknown
    0x12a4ab833 - Unknown
    0x12940fae3 - Unknown
    0x12940ffb9 - Unknown
    0x1003f4dd5 - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : mono_jit_runtime_invoke
    0x1005210e7 - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : mono_runtime_invoke_checked
    0x10052756c - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : mono_runtime_exec_main_checked
    0x100354a22 - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : mono_jit_exec
    0x100651a1e - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : xamarin_main
    0x10030f4a7 - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : main
    0x107528d29 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdyld.dylib : start
    0x3 - Unknown

=================================================================
    Basic Fault Address Reporting
=================================================================
Memory around native instruction pointer (0x122cb448d):0x122cb447d  48 8b 7f 08 48 85 ff 74 13 48 8b 73 10 48 8b 07  H...H..t.H.s.H..
0x122cb448d  ff 50 10 b8 ad ba ad de 48 89 43 10 48 83 c4 08  .P......H.C.H...
0x122cb449d  5b 5d c3 55 48 89 e5 53 50 48 89 fb 48 8d 05 90  [].UH..SPH..H...
0x122cb44ad  f2 29 00 48 89 07 48 8b 7f 08 48 85 ff 74 0a 48  .).H..H...H..t.H

=================================================================
    Managed Stacktrace:
=================================================================
      at <unknown> <0xffffffff>
      at Foundation.NSObject:xamarin_release_managed_ref <0x000cb>
      at Foundation.NSObject:ReleaseManagedRef <0x0007a>
      at NSObject_Disposer:Drain <0x00392>
      at <Module>:runtime_invoke_void_object <0x001a8>
      at <unknown> <0xffffffff>
      at UIKit.UIApplication:UIApplicationMain <0x00251>
      at UIKit.UIApplication:Main <0x000b2>
      at UIKit.UIApplication:Main <0x00132>
      at MyApp.iOS.Application:Main <0x00202>
      at <Module>:runtime_invoke_void_object <0x001a8>
=================================================================

The first thing that comes to mind is problems with disposing of some NSObject (possible some memory leak), but it is very strange that this problem doesn't reproduce on slower devices with a lower version of iOS.

Please tell me if anyone else has encountered a similar problem. Are there any assumptions about the source of the problem?


UIApplication.SharedApplication.OpenUrl crashes the app

$
0
0

I am using UIApplication.SharedApplication.OpenUrl to open an external url on the web browser.

When i come back to the back with back button on top and click on my mobile app, my app crashes.

How can I open an external link without crashing my app?

Crash caused by MvxCachingFragmentPagerAdapter.SaveState

$
0
0

Hi everyone!
I have a crash problem related to saving the states of fragments in Android.
This fragaments are in a viewpager.
It only happens to the 20% of my users.
If someone can help me with this will be awesome!

Here is the crash's trace:

Xamarin Exception Stack:
Java.Lang.IllegalStateException: Fragment OrderChangeFragment{28690c4 id=0x7f0c0136 md59b3106081f4498295e5f32c2c5c20282.OrderChangeFragment} is not currently in the FragmentManager
at Java.Interop.JniEnvironment+InstanceMethods.CallVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00069] in <7ba4922ae24c423fb56281db9df1ba38>:0
at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeAbstractVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x00014] in <7ba4922ae24c423fb56281db9df1ba38>:0
at Android.Support.V4.App.FragmentManagerInvoker.PutFragment (Android.OS.Bundle bundle, System.String key, Android.Support.V4.App.Fragment fragment) [0x00070] in :0
at MvvmCross.Droid.Support.V4.MvxCachingFragmentPagerAdapter.SaveState () [0x00099] in <80383b211f1049319c9769f83eb14f81>:0
at Android.Support.V4.View.PagerAdapter.n_SaveState (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in <33584823e4324beaa787e4d32e4d45a8>:0
at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.88(intptr,intptr)
at java.lang.IllegalStateException: Fragment OrderChangeFragment{28690c4 id=0x7f0c0136 md59b3106081f4498295e5f32c2c5c20282.OrderChangeFragment} is not currently in the FragmentManager
at android.support.v4.app.FragmentManagerImpl.putFragment(FragmentManager.java:923)
at mvvmcross.droid.support.v4.MvxCachingFragmentPagerAdapter.n_saveState(Native Method)
at mvvmcross.droid.support.v4.MvxCachingFragmentPagerAdapter.saveState(MvxCachingFragmentPagerAdapter.java:83)
at android.support.v4.view.ViewPager.onSaveInstanceState(ViewPager.java:1445)
at android.view.View.dispatchSaveInstanceState(View.java:14687)
at android.view.ViewGroup.dispatchSaveInstanceState(ViewGroup.java:3094)
at android.view.ViewGroup.dispatchSaveInstanceState(ViewGroup.java:3100)
at android.view.ViewGroup.dispatchSaveInstanceState(ViewGroup.java:3100)
at android.view.ViewGroup.dispatchSaveInstanceState(ViewGroup.java:3100)
at android.view.ViewGroup.dispatchSaveInstanceState(ViewGroup.java:3100)
at android.view.ViewGroup.dispatchSaveInstanceState(ViewGroup.java:3100)
at android.view.View.saveHierarchyState(View.java:14670)
at com.android.internal.policy.PhoneWindow.saveHierarchyState(PhoneWindow.java:1993)
at android.app.Activity.onSaveInstanceState(Activity.java:1384)
at android.support.v4.app.SupportActivity.onSaveInstanceState(ComponentActivity.java:83)
at android.support.v4.app.FragmentActivity.onSaveInstanceState(FragmentActivity.java:589)
at android.support.v7.app.AppCompatActivity.onSaveInstanceState(AppCompatActivity.java:510)
at md5c44e626e43e5b8d6d42d28410a243d52.MvxEventSourceAppCompatActivity.n_onSaveInstanceState(Native Method)
at md5c44e626e43e5b8d6d42d28410a243d52.MvxEventSourceAppCompatActivity.onSaveInstanceState(MvxEventSourceAppCompatActivity.java:103)
at android.app.Activity.performSaveInstanceState(Activity.java:1314)
at android.app.Instrumentation.callActivityOnSaveInstanceState(Instrumentation.java:1290)
at android.app.ActivityThread.callCallActivityOnSaveInstanceState(ActivityThread.java:4088)
at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:3490)
at android.app.ActivityThread.handleStopActivity(ActivityThread.java:3550)
at android.app.ActivityThread.access$1200(ActivityThread.java:150)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1368)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Issue implementing the deprecated AudioTrack.IOnRoutingChangedListener on Android M(23) phone

$
0
0

Hi,

I've an app which I'm wanting to target android 23 and above. I need to get notifications when the AudioDevice routing changes, but there API changes between android 23 and 24.

It looks straight forward to use the deprecated level 23 API - however, the level 23 AudioTrack.IOnRoutingChangedListener interface appears to incorrectly inherit from the level 24 IAudioRoutingOnRoutingChangedListener. This causes it to fall over when I try to instantiate the type on a Level 23 phone.

Is this intentional? It looks like a bug in the Xamarin library - if so could it be fixed, and is there a workaround?
[Obsolete("This class is obsoleted in this android platform")] [Register("android/media/AudioTrack$OnRoutingChangedListener", "", "Android.Media.AudioTrack/IOnRoutingChangedListenerInvoker", ApiSince = 23)] public interface IOnRoutingChangedListener : IAudioRoutingOnRoutingChangedListener, IJavaObject, IDisposable, IJavaPeerable { [Obsolete("deprecated")] [Register("onRoutingChanged", "(Landroid/media/AudioTrack;)V", GetOnRoutingChanged_Landroid_media_AudioTrack_Handler:Android.Media.AudioTrack/IOnRoutingChangedListenerInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")] void OnRoutingChanged(AudioTrack audioTrack); }

[Register("android/media/AudioRouting$OnRoutingChangedListener", "", "Android.Media.IAudioRoutingOnRoutingChangedListenerInvoker", ApiSince = 24)] public interface IAudioRoutingOnRoutingChangedListener : IJavaObject, IDisposable, IJavaPeerable { [Register("onRoutingChanged", "(Landroid/media/AudioRouting;)V", "GetOnRoutingChanged_Landroid_media_AudioRouting_Handler:Android.Media.IAudioRoutingOnRoutingChangedListenerInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")] void OnRoutingChanged(IAudioRouting router); }

Thanks!

Got a SIGABRT while executing native code - MKMapView

$
0
0

I have a Xamarin app running on an iOS device. In this application, I have a map with 1 to N polygons, according to the image below. These polygons represent sectors of a farm. The purpose of my app is to show the farm sectors on the map and give the user the ability to select one or more sectors on this map. By selecting the sector, it changes color to show the user that it is already selected, if they touch the sector again it changes color, so the user can easily select the selected and unselected sectors.
When I run the application, the execution is going well, no problem selecting and deselecting the sector. When I try to close the map screen using the OK button The app stops and the app exit:

objc[80328]: Attempt to use unknown class 0xd6266328e530.

=================================================================

Native Crash Reporting

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.

=================================================================

Basic Fault Adddress Reporting

Memory around native instruction pointer (0x1116a1eb6):0x1116a1ea6 ff ff c3 90 90 90 b8 09 02 00 02 49 89 ca 0f 05 ...........I....
0x1116a1eb6 73 08 48 89 c7 e9 29 7c ff ff c3 90 90 90 b8 1e s.H...)|........
0x1116a1ec6 00 00 02 49 89 ca 0f 05 73 08 48 89 c7 e9 36 7c ...I....s.H...6|
0x1116a1ed6 ff ff c3 90 90 90 b8 94 01 00 02 49 89 ca 0f 05 ...........I....

=================================================================

Native stacktrace:

0x101e9d960 - /Users/matheuscrespischenfeld/Library/Developer/CoreSimulator/Devices/A1EADC21-E4A6-4A0D-BFBB-23326D7380BE/data/Containers/Bundle/Application/2B9060CB-87CE-4C1B-A2FF-25158B422E8E/Elysios.Demetra.App.iOS.app/Frameworks/Mono.framework/Mono : mono_dump_native_crash_info
0x101e470c5 - /Users/matheuscrespischenfeld/Library/Developer/CoreSimulator/Devices/A1EADC21-E4A6-4A0D-BFBB-23326D7380BE/data/Containers/Bundle/Application/2B9060CB-87CE-4C1B-A2FF-25158B422E8E/Elysios.Demetra.App.iOS.app/Frameworks/Mono.framework/Mono : mono_handle_native_crash
0x1116c7f5a - /usr/lib/system/libsystem_platform.dylib : _sigtramp
0x7000008201e0 - Unknown
0x11169c25f - /usr/lib/system/libsystem_kernel.dylib : abort_with_payload_wrapper_internal
0x1104af1f5 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc.A.dylib : _ZL12_objc_fatalvyyPKcP13__va_list_tag
0x1104af11e - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc.A.dylib : __objc_error
0x1104b6c18 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc.A.dylib : class_copyProtocolList
0x1019d9a53 - /Users/matheuscrespischenfeld/Library/Developer/CoreSimulator/Devices/A1EADC21-E4A6-4A0D-BFBB-23326D7380BE/data/Containers/Bundle/Application/2B9060CB-87CE-4C1B-A2FF-25158B422E8E/Elysios.Demetra.App.iOS.app/Elysios.Demetra.App.iOS : _ZL22get_method_descriptionP10objc_classP13objc_selector
0x1019d96cb - /Users/matheuscrespischenfeld/Library/Developer/CoreSimulator/Devices/A1EADC21-E4A6-4A0D-BFBB-23326D7380BE/data/Containers/Bundle/Application/2B9060CB-87CE-4C1B-A2FF-25158B422E8E/Elysios.Demetra.App.iOS.app/Elysios.Demetra.App.iOS : xamarin_get_frame_length
0x1019e867c - /Users/matheuscrespischenfeld/Library/Developer/CoreSimulator/Devices/A1EADC21-E4A6-4A0D-BFBB-23326D7380BE/data/Containers/Bundle/Application/2B9060CB-87CE-4C1B-A2FF-25158B422E8E/Elysios.Demetra.App.iOS.app/Elysios.Demetra.App.iOS : xamarin_dyn_objc_msgSend
0x13582ac80 - Unknown
0x13549ad7a - Unknown
0x101fff14f - /Users/matheuscrespischenfeld/Library/Developer/CoreSimulator/Devices/A1EADC21-E4A6-4A0D-BFBB-23326D7380BE/data/Containers/Bundle/Application/2B9060CB-87CE-4C1B-A2FF-25158B422E8E/Elysios.Demetra.App.iOS.app/Frameworks/Mono.framework/Mono : mono_gc_run_finalize
0x10201ebda - /Users/matheuscrespischenfeld/Library/Developer/CoreSimulator/Devices/A1EADC21-E4A6-4A0D-BFBB-23326D7380BE/data/Containers/Bundle/Application/2B9060CB-87CE-4C1B-A2FF-25158B422E8E/Elysios.Demetra.App.iOS.app/Frameworks/Mono.framework/Mono : sgen_gc_invoke_finalizers
0x102000f03 - /Users/matheuscrespischenfeld/Library/Developer/CoreSimulator/Devices/A1EADC21-E4A6-4A0D-BFBB-23326D7380BE/data/Containers/Bundle/Application/2B9060CB-87CE-4C1B-A2FF-25158B422E8E/Elysios.Demetra.App.iOS.app/Frameworks/Mono.framework/Mono : finalizer_thread
0x101fae409 - /Users/matheuscrespischenfeld/Library/Developer/CoreSimulator/Devices/A1EADC21-E4A6-4A0D-BFBB-23326D7380BE/data/Containers/Bundle/Application/2B9060CB-87CE-4C1B-A2FF-25158B422E8E/Elysios.Demetra.App.iOS.app/Frameworks/Mono.framework/Mono : start_wrapper_internal
0x101fae267 - /Users/matheuscrespischenfeld/Library/Developer/CoreSimulator/Devices/A1EADC21-E4A6-4A0D-BFBB-23326D7380BE/data/Containers/Bundle/Application/2B9060CB-87CE-4C1B-A2FF-25158B422E8E/Elysios.Demetra.App.iOS.app/Frameworks/Mono.framework/Mono : start_wrapper
0x1116d9661 - /usr/lib/system/libsystem_pthread.dylib : _pthread_body
0x1116d950d - /usr/lib/system/libsystem_pthread.dylib : _pthread_body
0x1116d8bf9 - /usr/lib/system/libsystem_pthread.dylib : thread_start

=================================================================

Managed Stacktrace:

      at <unknown> <0xffffffff>
      at ObjCRuntime.Messaging:void_objc_msgSend <0x000bf>
      at ObjCRuntime.BaseWrapper:Dispose <0x00162>
      at ObjCRuntime.BaseWrapper:Finalize <0x0006b>

at System.Object:runtime_invoke_virtual_void__this__ <0x000c9>

I have some polygons on a mapView according to the image:

This error occurs when I try to close this map page, so it makes me think that my problem is in my e.OldElement that is:

if (e.OldElement != null)
        {
            try
            {
                nativeMap = Control as MKMapView;
                nativeMap.OverlayRenderer = null;
                if (nativeMap != null)
                {
                    nativeMap.RemoveOverlays(nativeMap.Overlays);
                    nativeMap.RemoveGestureRecognizer(tap);
                    Polygons.Clear();
                }
            }
            catch (Exception eOld)
            {
                Debug.WriteLine(eOld.Message);
            }
        }

My e.NewElement is:

if (e.NewElement != null)
            {
                formsMap = (CustomMap)e.NewElement;
                nativeMap = Control as MKMapView;
                try
                {
                    Polygons = formsMap.Polygons;
                    nativeMap.OverlayRenderer = GetOverlayRenderer;
                    for (int i = 0; i < Polygons.Count; i++)
                    {
                        CLLocationCoordinate2D[] coords = new CLLocationCoordinate2D[Polygons[i].Vertices.Count];
                        int index = 0;
                        foreach (var position in Polygons[i].Vertices)
                        {
                            coords[index] = new CLLocationCoordinate2D(latitude: position.Latitude, longitude: position.Longitude);
                            index++;
                        }
                        blockOverlay = new PolygonIOS(MKPolygon.FromCoordinates(coords));
                        blockOverlay.FillColor = Color.FromUint((uint)Polygons[i].Color).ToUIColor();
                        blockOverlay.StrokeColor = Color.FromUint((uint)Polygons[i].StrokeColor).ToUIColor();
                        nativeMap.AddOverlay(blockOverlay);
                    }
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex);
                }

                tap = new UITapGestureRecognizer(g =>
                {
                    var pt = g.LocationInView(nativeMap);
                    CLLocationCoordinate2D tapCoord = nativeMap.ConvertPoint(pt, nativeMap);
                    Console.WriteLine("new CLLocationCoordinate2D({0}, {1}),", tapCoord.Latitude, tapCoord.Longitude);
                    Position clickedPos = new Position(tapCoord.Latitude, tapCoord.Longitude);
                    formsMap.OniOSMapClicked(this, clickedPos, e); //method to verify if the position of touch is inside or outside de polygon
                    RefreshPolygons(formsMap); // method to refresh polygons and in this way alter color to show if sector is selected or not
                });
                nativeMap.AddGestureRecognizer(tap);
            }
        }

As you can see I have an UITapGestureRecognizer estou identify where the user have touched and the rest of the code is:

public MKOverlayRenderer GetOverlayRenderer(MKMapView mapView, IMKOverlay overlayWrapper)
        {
            return new MKPolygonRenderer(overlayWrapper as MKPolygon)
            {
                FillColor = (overlayWrapper as PolygonIOS).FillColor,
                StrokeColor = (overlayWrapper as PolygonIOS).StrokeColor,
                Alpha = 0.4f,
                LineWidth = 2
            };
        }

        public void RefreshPolygons(CustomMap formsMap)
        {
            var nativeMap = Control as MKMapView;

            if (nativeMap != null && formsMap != null)
            {
                try
                {
                    nativeMap.RemoveOverlays(nativeMap.Overlays);
                    Polygons = formsMap.Polygons;
                    nativeMap.OverlayRenderer = GetOverlayRenderer;
                    for (int i = 0; i < Polygons.Count; i++)
                    {
                        CLLocationCoordinate2D[] coords = new CLLocationCoordinate2D[Polygons[i].Vertices.Count];
                        int index = 0;
                        foreach (var position in Polygons[i].Vertices)
                        {
                            coords[index] = new CLLocationCoordinate2D(latitude: position.Latitude, longitude: position.Longitude);
                            index++;
                        }
                        blockOverlay = new PolygonIOS(MKPolygon.FromCoordinates(coords));
                        blockOverlay.FillColor = Color.FromUint((uint)Polygons[i].Color).ToUIColor();
                        blockOverlay.StrokeColor = Color.FromUint((uint)Polygons[i].StrokeColor).ToUIColor();
                        nativeMap.AddOverlay(blockOverlay);
                    }
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex);
                }

                MKOverlayRenderer GetOverlayRenderer(MKMapView mapView, IMKOverlay overlayWrapper)
                {
                    return new MKPolygonRenderer(overlayWrapper as MKPolygon)
                    {
                        FillColor = (overlayWrapper as PolygonIOS).FillColor,
                        StrokeColor = (overlayWrapper as PolygonIOS).StrokeColor,
                        Alpha = 0.4f,
                        LineWidth = 2
                    };
                }
            }
        }

At this line blockOverlay = new PolygonIOS(MKPolygon.FromCoordinates(coords)); this new PolygonIOS is one class that inherits MKPolygon, but I added more two properties that are:

        public UIColor FillColor;
        public UIColor StrokeColor; 

I have been working on this error for the past few days but I have not yet succeeded in my attempts.
Every time I click Ok this error occurs again. If it helps to explain the issue the Device System Log is Dec 16 16:49:26 MacBook-Pro-de-Matheus.Demetra.App.iOS[80328]: objc[80328]: Attempt to use unknown class 0xd6266328e530.

I really need help in this issue and I am available to explain the situation better

Xamarin - Android Tablayout in each item of Recycler view

$
0
0

I'm Trying to create a Recycler view whose each item will contain a Tab layout with View pager.
The Problem I'm facing right now is only first item contains Tab layout rest of items are empty.

Below are the codes for Layouts, service and Adapter.

Tablayout.xml

<android.support.design.widget.TabLayout
        android:id="@+id/tabs"
        android:layout_width="match_parent"
        android:foregroundGravity="center"
        local:tabGravity="center"
        android:layout_gravity="center_vertical"
        android:paddingVertical = "22dp"
        local:tabPaddingBottom = "0dp"
        local:tabIndicatorFullWidth="true"
        local:tabIndicatorGravity="bottom"
        local:tabTextAppearance="@style/AppTabTextAppearance"
        local:tabMode="fixed"
        local:tabIndicatorHeight="2dp"
        style="@style/CustomTabLayout"
        android:layout_height="wrap_content">
</android.support.design.widget.TabLayout>
<android.support.v4.view.ViewPager
        android:background="@android:color/transparent"
        android:id="@+id/pager"
        android:layout_below = "@id/tabs"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
</android.support.v4.view.ViewPager>

In Recycler view Tablayout will pass as a mvxItemTemplate

RecyclerView.xml

  <MvvmCross.Droid.Support.V7.RecyclerView.MvxRecyclerView
     card_view:MvxItemTemplate="@layout/Tablayout
     card_view:MvxBind="ItemsSource Routes"

    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/recycler_view"
    android:scrollbars="vertical"        
    />

This Service will be call for each item of recycler view and initializes view pager and Tablayout

TablayoutService.cs

public class TablayoutService
{ 
  public void ShowReadOutExpandedSection() 
    {
        var top = Mvx.IoCProvider.Resolve<IMvxAndroidCurrentTopActivity>();
        var act = top.Activity as MvxAppCompatActivity;
        ViewPager viewPager = act.FindViewById<ViewPager>(Resource.Id.pager);
        viewPager.Adapter = new TabViewPagerAdapter(act.SupportFragmentManager) ;
        var tabLayout = act.FindViewById<TabLayout>(Resource.Id.tabs);
        tabLayout.SetupWithViewPager(viewPager);
    }
 }

This Adpater will attach 3 fragments with tabtiles

TabViewPagerAdapter.cs

public class ExpandedTabViewPagerAdapter : MvxCachingFragmentPagerAdapter
{
    const int PAGE_COUNT = 3;
    // Tab Titles
    private string[] tabtitles = Android.App.Application.Context.Resources.GetStringArray(Resource.Array.Top_Tab_Elements);

    public ExpandedTabViewPagerAdapter(FragmentManager fm) : base(fm) { }
    public override int Count
    {
        get { return PAGE_COUNT; }
    }
    public override Java.Lang.ICharSequence GetPageTitleFormatted(int position)
    {
        return new Java.Lang.String(tabtitles[position]);
    }

    public override Fragment GetItem(int position, Fragment.SavedState fragmentSavedState = null)
    {
        switch (position)
        {
            case 0:
                ExpandedEstateFragment fragmenttab1 = (ExpandedEstateFragment)Activator.CreateInstance(typeof(ExpandedEstateFragment));
                var viewModelLoader = Mvx.IoCProvider;
                fragmenttab1.ViewModel = viewModelLoader.Resolve<IMvxViewModelLoader>().LoadViewModel(MvxViewModelRequest.GetDefaultRequest(typeof(ExpandedEstateViewModel)), null, null);
                return fragmenttab1;
            case 1:
                ExpandedEstateFragment fragmenttab2 = (ExpandedEstateFragment)Activator.CreateInstance(typeof(ExpandedEstateFragment));
                viewModelLoader = Mvx.IoCProvider;
                fragmenttab2.ViewModel = viewModelLoader.Resolve<IMvxViewModelLoader>().LoadViewModel(MvxViewModelRequest.GetDefaultRequest(typeof(ExpandedEstateViewModel)), null, null);
                return fragmenttab2;
            case 2:
                ExpandedEstateFragment fragmenttab3 = (ExpandedEstateFragment)Activator.CreateInstance(typeof(ExpandedEstateFragment));
                viewModelLoader = Mvx.IoCProvider;
                fragmenttab3.ViewModel = viewModelLoader.Resolve<IMvxViewModelLoader>().LoadViewModel(MvxViewModelRequest.GetDefaultRequest(typeof(ExpandedEstateViewModel)), null, null);
                return fragmenttab3;
        }
        return null;
    }

}

How to restrict numeric values entered into an Entry field.

$
0
0

I need to restrict the value being typed into an Entry field to values between 0 and 20. However, I don't want highlight it in red if it's outside that range or anything, I want to actually prevent the value from appearing in the field if the user types 30, for example (the 3 would appear since it's valid but if the user then types a 0 it should not be accepted). I have successfully used behaviors to validate things like email addresses and date formats and was wondering if I can create a behavior to do this numeric validation and if so how I would go about it? Should I interrogate the entry using the TextChanged event or something?

Solution can't deploy to emulator in VS2019, works fine in VS2017

$
0
0

I have a Xamarin solution that was initially created in VS2017 in Windows. Everything works as expected, can build and deploy to a emulator for debugging with no issues.

I want to use VS2019 in Windows but have been having some issues with this particular solution. I am able to open and build the Xamarin solution, but when I try to deploy to a Emulator I get this error:

MSB4044: The "CopyGeneratedJavaResourceClasses" task was not given a value for the required parameter "SourceTopDirectory".

It is odd because the Android Device Manager shares the same emulators with VS2017 and VS2019, so I don't think the emulator is the issue. Is there anything I need to do to migrate a VS2017 solution to be compatible with VS2019?


Xamarin forms ios firebase remote config

$
0
0

Hi!
I cant seem to find any good tutorial on how to setup firebase remote config for xamarin ios and android. Could anyone share how it should be done? Specifically for xamarin forms iOS version.

Erreur provoqué lors de l'upload de plusieurs images

$
0
0

I try to upload at least 30 pictures to a web server but my program catch errors. They appear randomly, sometimes at the first image, sometimes third etc.

ERREUR

{System.Net.Http.HttpRequestException: Error while copying content to a stream. ---> System.IO.IOException: Unable to write data to the transport connection: Connection reset by peer. ---> System.Net.Sockets.SocketException: Connection reset by peer at System.Net.Sockets.Socket.EndSend (System.IAsyncResult asyncResult) [0x0000c] in /Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/mcs/class/referencesource/System/net/System/Net/Sockets/Socket.cs:3874 at System.Net.Sockets.NetworkStream.EndWrite (System.IAsyncResult asyncResult) [0x00057] in /Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/mcs/class/referencesource/System/net/System/Net/Sockets/NetworkStream.cs:1043 --- End of inner exception stack trace ---

OR

Read error: ssl=0x7e46332e08: I/O error during system call, Connection reset by peer

PROCESS
I explain you the process : I got an array with image path and I created a loop to upload each image on my web server.

public static async Task CreateUploadTask(string file, string id, string user_id, string user_login)
{

        string requestResult = "";

        var cont = new MultipartFormDataContent();
        var image = new StreamContent(File.OpenRead(file));
        image.Headers.ContentDisposition = new ContentDispositionHeaderValue("form-data") { Name = "file", FileName = "imageToUpload.jpeg" };
        image.Headers.ContentType = new MediaTypeHeaderValue("image/jpeg");
        cont.Add(image);

        string id_level = id
        string uri = // private uri
        using (var client = new HttpClient())
        {
            var response = await client.PostAsync(uri, cont);
            if (response.StatusCode != System.Net.HttpStatusCode.OK)
            {
                return "error";
            }

            requestResult = response.Content.ReadAsStringAsync().Result;
            Console.WriteLine("DATA FINAL" + requestResult);

        }

        return requestResult;

    }

Tell me if you already got this errors when you uploading files. How to solve it, I saw in some topics, some people have the same issue. It can be usefull to resolve this issue. Thank you in advance.

UPDATE
public async void LaunchImagesUpload()
{
for (int i = startIndex; i < picturesToUpload.Count; i++)
{
try
{
currentPath = i;
await UploadSinglePicture(i);
}
catch (Exception e)
{

                if (e.Message.Equals("The operation was canceled."))
                      {


                    currentPictureGrid.ActivateCancelledMode("Temps de transfert trop long.");
                          if (!picturesToReupload.Contains(i))
                              picturesToReupload.Add(i);
                      }
                      else if (e.Message.Equals("Error while copying content to a stream."))
                      {
                          currentPictureGrid.ActivateCancelledMode("Error, retry");
                          if (!picturesToReupload.Contains(i))
                            await UploadSinglePicture(i);
                      }
                      else
                      {
                            await UploadSinglePicture(i);
                      }

                  }

        }
    }

How to change NavigationPage.TitleView

$
0
0

Hi,
I have a TabedPage with a NavigationPage.TitleView.
Its showing on every ChildPage.
But on a certain ChildPage (CalendarPage) i need to change the TitleView and show some other text.
I can not figure out how to do this.

TabbedPage.xaml
...
<NavigationPage.TitleView>

</NavigationPage.TitleView>
<TabbedPage.Children>

       <local:HomePage
        Title="Home"
        Icon="outline_home_black_24.png"/>

    <NavigationPage Title="Calendar" Icon="ic_calendar_month_outline_black_24dp.png">
        <x:Arguments>
            <local:CalendarPage />
        </x:Arguments>
    </NavigationPage>

</TabbedPage.Children>

Tried to remove the TabbedPage.Navigation Bar and adding a new one on CalendarPage without success.

Issue implementing the deprecated AudioTrack.IOnRoutingChangedListener on Android M(23) phone

$
0
0

Hi,

I've an app which I'm wanting to target android 23 and above. I need to get notifications when the AudioDevice routing changes, but there API changes between android 23 and 24.

It looks straight forward to use the deprecated level 23 API - however, the level 23 AudioTrack.IOnRoutingChangedListener interface appears to incorrectly inherit from the level 24 IAudioRoutingOnRoutingChangedListener. This causes it to fall over when I try to instantiate the type on a Level 23 phone.

Is this intentional? It looks like a bug in the Xamarin library - if so could it be fixed, and is there a workaround?
[Obsolete("This class is obsoleted in this android platform")] [Register("android/media/AudioTrack$OnRoutingChangedListener", "", "Android.Media.AudioTrack/IOnRoutingChangedListenerInvoker", ApiSince = 23)] public interface IOnRoutingChangedListener : IAudioRoutingOnRoutingChangedListener, IJavaObject, IDisposable, IJavaPeerable { [Obsolete("deprecated")] [Register("onRoutingChanged", "(Landroid/media/AudioTrack;)V", GetOnRoutingChanged_Landroid_media_AudioTrack_Handler:Android.Media.AudioTrack/IOnRoutingChangedListenerInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")] void OnRoutingChanged(AudioTrack audioTrack); }

[Register("android/media/AudioRouting$OnRoutingChangedListener", "", "Android.Media.IAudioRoutingOnRoutingChangedListenerInvoker", ApiSince = 24)] public interface IAudioRoutingOnRoutingChangedListener : IJavaObject, IDisposable, IJavaPeerable { [Register("onRoutingChanged", "(Landroid/media/AudioRouting;)V", "GetOnRoutingChanged_Landroid_media_AudioRouting_Handler:Android.Media.IAudioRoutingOnRoutingChangedListenerInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")] void OnRoutingChanged(IAudioRouting router); }

Thanks!

How to bundle a .NET app with mono, such that it can be signed, or such that it can run w/o crashing

$
0
0

Please Note: The project is not a Xamarin.Mac project but a .NET 4.5 project, I've seen a lot of similar questions asked here where answers come from people who seem to know a lot of about mono in general. If this is the wrong place to ask this. I will take down this post.

I've been struggling with this for a month now, unable to bundle a .NET exe with mono such that it runs correctly on a target macOS 10.14 after having been codesignged with strict and hardened runtime options. Either working bundle cannot be signed, or I have a non-working bundle that can be signed.

I have a test project on github, but my account is too new here to share it. The app is a simple "hello world" .NET console app with no external dependencies.

I'll repeat here:

I found a related bug on xamarin bugzilla but cannot share it here. I cannot find any other references to this issue on mono github / stack overflow / xamarin community forums

Requirements:
- Mac OS 10.14.6
- Visual Studio for Mac 8.3.9
- XCode 11
- Mono 6.4.0
- A Signing Certificate (self signed used below)

Steps to reproduce issue(s)

Case 1:
1. compile a .NET 4.5 console app in VS with release config, produces testConsoleApp.exe
2. in the project folder execute the below command of mkbundle with --simple flag
- produces testConsoleApp binary which works when run on the command line "./bin/Release/testConsoleApp"

mkbundle -v -o testConsoleApp --deps --simple testConsoleApp.exe --sdk $MONOROOT/Versions/Current
  1. in the project folder execute the signing command below which code signs with --strict -o runtime and entitlements
codesign -f --strict --verbose --entitlements $ENTSFILE -o runtime -s "$CERT" testConsoleApp --timestamp

Expected: signing to be successful

Actual: signing is unsuccessful, console error: "testConsoleApp: main executable failed strict validation"

Case 2:
1. compile a .NET 4.5 console app in VS with release config, produces testConsoleApp.exe
2. in the project folder execute the below command of mkbundle with -L flag and passes mono directory for the path
- produces testConsoleApp binary which seg faults, error code 11, when run on the command line "./bin/Release/testConsoleApp"
- stack trace below, can't link too it...

 mkbundle -v -o testConsoleApp --deps testConsoleApp.exe -L $MONOROOT/Versions/Current/lib/mono/4.5/
  1. in the project folder execute './signTestConsoleApp.sh strict {cert-to-use}', which code signs with --strict -o runtime and entitlements
codesign -f --strict --verbose --entitlements $ENTSFILE -o runtime -s "$CERT" testConsoleApp --timestamp

Expected: signing to be successful

Actual: signing is successful, but the program still seg faults when executed "./bin/Debug/testConsoleApp"

On which platforms did you notice this

[X ] macOS
[ ] Linux
[ ] Windows

Stacktrace

Process: testConsoleApp [71605]
Path: /Users/*/testConsoleApp
Identifier: testConsoleApp
Version: 0
Code Type: X86-64 (Native)
Parent Process: bash [53460]
Responsible: testConsoleApp [71605]
User ID: 490749117

Date/Time: 2019-11-22 11:51:05.126 -0500
OS Version: Mac OS X 10.14.5 (18F132)
Report Version: 12
Anonymous UUID: DF34AE02-2897-021E-660E-FE6E4146A6B8

Sleep/Wake UUID: B3602C3E-8214-4A17-91B8-05C3B13F041F

Time Awake Since Boot: 270000 seconds
Time Since Wake: 8300 seconds

System Integrity Protection: enabled

Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY

Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [71605]

VM Regions Near 0:
-->
__TEXT 000000010f3cb000-000000010f3cc000 [ 4K] r-x/r-x SM=COW /Users/*

Application Specific Information:
dyld2 mode

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 ??? 000000000000000000 0 + 0
1 testConsoleApp 0x000000010f3cbb16 mono_mkbundle_init + 22 (temp.c:158)
2 testConsoleApp 0x000000010f3cbcc8 main + 376 (temp.c:235)
3 libdyld.dylib 0x00007fff7e6883d5 start + 1

Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x00007fcf78005070 rbx: 0x0000000000000000 rcx: 0x0000000000000002 rdx: 0x0000000000000001
rdi: 0x000000010f3cc0d0 rsi: 0x0000000000000002 rbp: 0x00007ffee0834420 rsp: 0x00007ffee0834418
r8: 0x00000000f7800508 r9: 0x00000000fffffeff r10: 0x00007fcf78000000 r11: 0x000000000000000e
r12: 0x0000000000000000 r13: 0x0000000000000000 r14: 0x0000000000000000 r15: 0x0000000000000000
rip: 0x0000000000000000 rfl: 0x0000000000010246 cr2: 0x0000000000000000

Logical CPU: 6
Error Code: 0x00000014
Trap Number: 14

Binary Images:
0x10f3cb000 - 0x10f3cbffb +testConsoleApp (0) <5F5740B6-64AC-319F-B350-DD9F457A1E67> /Users/*/testConsoleApp
0x10f865000 - 0x10fc5dff7 +libmonosgen-2.0.1.dylib (0) /Library/Frameworks/Mono.framework/Versions/6.4.0/lib/libmonosgen-2.0.1.dylib
0x11f40e000 - 0x11f4786ef dyld (655.1.1) /usr/lib/dyld

Viewing all 204402 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>