Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How should I use it on release mode for xamarin forms? #36

Open
cansado2930 opened this issue Nov 18, 2017 · 5 comments
Open

How should I use it on release mode for xamarin forms? #36

cansado2930 opened this issue Nov 18, 2017 · 5 comments
Labels
xamarin Track all Xamarin related issues.

Comments

@cansado2930
Copy link

Hello,
I have Xamarin forms app and It works perfectly on debug mode. But when I build of release mode, I receive a exception of concurrency. I'm using a ConcurrentBag in order to save RemoteSystem but it crashes when add ítems. How should I do it in order to save ítems in a list?
Thank you

@cmknox
Copy link
Contributor

cmknox commented Nov 21, 2017

@cansado2930 can you please provide a snippet of your code and where the problem is?

@cansado2930
Copy link
Author

Hi @cmknox
Yes, without problems. This is the code:

private static ObservableCollection deviceList = new ObservableCollection();
private static RemoteSystemWatcher _remoteSystemWatcher;
//....//
private static void searchdevices()
{
_remoteSystemWatcher = RemoteSystem.CreateWatcher();
// Subscribing to the event that will be raised when a new remote system is found by the watcher.
_remoteSystemWatcher.RemoteSystemAdded += RemoteSystemWatcher_RemoteSystemAdded;
// Start the watcher.
_remoteSystemWatcher.Start();
}
private static async void RemoteSystemWatcher_RemoteSystemAdded(RemoteSystemWatcher sender, RemoteSystemAddedEventArgs args)
{
try
{
deviceList.Add(args.P0);
}
catch (Exception) { }
}
//....//

As you can see, I call to searchDevices in order to actívate the searcher. The RemoteSystemWatcher_RemoteSystemAdded function, on the line "deviceList.add(args.P0)" is the "problem". On debug mode, as App run slow it Works correctly but when It is built on release mode
then app crash in this line, with a message of concurrency problem that I have been able to check on log. Do you have some advice in order to avoid this problem and save devices on a list.
Thank you!

@cmknox
Copy link
Contributor

cmknox commented Nov 27, 2017

@cansado2930 thanks for the reply. We are currently working on a new release for Xamarin that should address your problem. Stay tuned for later this week.

@cmknox
Copy link
Contributor

cmknox commented Nov 28, 2017

@cansado2930 we have released a new Xamarin SDK drop, 0.8.0, can you please give it a try and let me know if it works for you?

@cansado2930
Copy link
Author

cansado2930 commented Nov 29, 2017

Yes, I can. I have updated to 0.8.0 and I have built the reléase versión (because the debug with 0.8. Works correctly) and it crash again. I have attached the console log:

11-29 18:45:18.603 V/CDP (13130): {"date":"2017-11-29T18:45:18.603","PID":13130,"TID":13406,"message":{ "text":"Not registering directly with CCS because CCSRegistration is disabled" },"level":4,"flags":2}
11-29 18:45:18.604 I/CDP (13130): {"date":"2017-11-29T18:45:18.604","PID":13130,"TID":13406,"message":{ "text":"UserNotificationClient::RegisterUserDeviceWithDds() called for user d5c476cc0fd5a5fd with reason: Startup" },"level":3,"flags":2}
11-29 18:45:18.604 V/CDP (13130): {"date":"2017-11-29T18:45:18.604","PID":13130,"TID":13406,"message":{ "text":"IsRegistrationRequired() - An empty push notification channel URI expiration time has been specified." },"level":4,"flags":2}
{"date":"2017-11-29T18:45:18.607","PID":13130,"TID":13406,"message":{ "text":"No user settings entry in map for Stable User Id 'd5c476cc0fd5a5fd', creating." },"level":3,"flags":2}
11-29 18:45:18.607 I/CDP (13130): {"date":"2017-11-29T18:45:18.607","PID":13130,"TID":13406,"message":{ "text":"No user settings entry in map for Stable User Id 'd5c476cc0fd5a5fd', creating." },"level":3,"flags":2}
{"date":"2017-11-29T18:45:18.619","PID":13130,"TID":13406,"message":{ "text":"Wrote settings file for stable user id d5c476cc0fd5a5fd" },"level":3,"flags":2}
11-29 18:45:18.619 I/CDP (13130): {"date":"2017-11-29T18:45:18.619","PID":13130,"TID":13406,"message":{ "text":"Wrote settings file for stable user id d5c476cc0fd5a5fd" },"level":3,"flags":2}
{"date":"2017-11-29T18:45:18.621","PID":13130,"TID":13406,"message":{ "hr":{ "error":"E_CDP_JNI_RUNTIME_ERROR","value":"0x80040a03" },"file":"/mnt/e/linux_repos/cdp/core/private/UserNotificationClient.cpp","line":270,"exception_text":"no static method "Lcom/microsoft/connecteddevices/DeviceProperties;.getPlatformDeviceName()Ljava/lang/String;"","text":"Unable to register with DDS; Failed with hr = 0x80040a03" },"level":1,"flags":2
11-29 18:45:18.620 W/System.err(13130): java.lang.NoSuchMethodError: no static method "Lcom/microsoft/connecteddevices/DeviceProperties;.getPlatformDeviceName()Ljava/lang/String;"
11-29 18:45:18.620 W/System.err(13130): at com.microsoft.connecteddevices.PlatformInternal.initializeInternal(Native Method)
11-29 18:45:18.620 W/System.err(13130): at com.microsoft.connecteddevices.PlatformInternal.initialize(PlatformInternal.java:71)
11-29 18:45:18.620 W/System.err(13130): at com.microsoft.connecteddevices.Platform$2.onDone(Platform.java:160)
11-29 18:45:18.620 W/System.err(13130): at com.microsoft.connecteddevices.Platform$AccessTokenRefresher$AccessTokensFetchTask.run(Platform.java:630)
11-29 18:45:18.620 W/System.err(13130): at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
11-29 18:45:18.620 W/System.err(13130): at java.util.concurrent.FutureTask.run(FutureTask.java:237)
11-29 18:45:18.620 W/System.err(13130): at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:272)
{"date":"2017-11-29T18:45:18.621","PID":13130,"TID":13406,"message":Failed to register device, hr: -2147218941,"level":1,"flags":2147483648}
11-29 18:45:18.620 W/System.err(13130): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
11-29 18:45:18.621 W/System.err(13130): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
11-29 18:45:18.621 W/System.err(13130): at java.lang.Thread.run(Thread.java:761)
11-29 18:45:18.621 E/CDP (13130): {"date":"2017-11-29T18:45:18.621","PID":13130,"TID":13406,"message":{ "hr":{ "error":"E_CDP_JNI_RUNTIME_ERROR","value":"0x80040a03" },"file":"/mnt/e/linux_repos/cdp/core/private/UserNotificationClient.cpp","line":270,"exception_text":"no static method "Lcom/microsoft/connecteddevices/DeviceProperties;.getPlatformDeviceName()Ljava/lang/String;"","text":"Unable to register with DDS; Failed with hr = 0x80040a03" },"level":1,"flags":2}
11-29 18:45:18.621 E/CDP (13130): {"date":"2017-11-29T18:45:18.621","PID":13130,"TID":13406,"message":Failed to register device, hr: -2147218941,"level":1,"flags":2147483648}
11-29 18:45:18.793 F/art (13130): art/runtime/java_vm_ext.cc:470] JNI DETECTED ERROR IN APPLICATION: mid == null
11-29 18:45:18.793 F/art (13130): art/runtime/java_vm_ext.cc:470] in call to NewObjectV
11-29 18:45:18.793 F/art (13130): art/runtime/java_vm_ext.cc:470] from void com.microsoft.connecteddevices.PlatformInternal.initializeInternal(android.content.Context, com.microsoft.connecteddevices.IWebAccountProvider, java.lang.String, java.lang.String)
11-29 18:45:18.793 F/art (13130): art/runtime/java_vm_ext.cc:470] "pool-37-thread-1" prio=5 tid=100 Runnable
11-29 18:45:18.793 F/art (13130): art/runtime/java_vm_ext.cc:470] | group="main" sCount=0 dsCount=0 obj=0x13351310 self=0x86d0d200
11-29 18:45:18.793 F/art (13130): art/runtime/java_vm_ext.cc:470] | sysTid=13406 nice=0 cgrp=default sched=0/0 handle=0x66541920
11-29 18:45:18.793 F/art (13130): art/runtime/java_vm_ext.cc:470] | state=R schedstat=( 305371832 11119323 225 ) utm=27 stm=3 core=2 HZ=100
11-29 18:45:18.793 F/art (13130): art/runtime/java_vm_ext.cc:470] | stack=0x6643f000-0x66441000 stackSize=1038KB
11-29 18:45:18.793 F/art (13130): art/runtime/java_vm_ext.cc:470] | held mutexes= "mutator lock"(shared held)
11-29 18:45:18.793 F/art (13130): art/runtime/java_vm_ext.cc:470] native: #00 pc 00350131 /system/lib/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+128)
11-29 18:45:18.793 F/art (13130): art/runtime/java_vm_ext.cc:470] native: #1 pc 00330939 /system/lib/libart.so (_ZNK3art6Thread9DumpStackERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbP12BacktraceMap+308)
11-29 18:45:18.793 F/art (13130): art/runtime/java_vm_ext.cc:470] native: #2 pc 00239805 /system/lib/libart.so (ZN3art9JavaVMExt8JniAbortEPKcS2+848)
11-29 18:45:18.793 F/art (13130): art/runtime/java_vm_ext.cc:470] native: #3 pc 00239d9b /system/lib/libart.so (_ZN3art9JavaVMExt9JniAbortFEPKcS2_z+66)
11-29 18:45:18.793 F/art (13130): art/runtime/java_vm_ext.cc:470] native: #4 pc 002646a1 /system/lib/libart.so (_ZN3art3JNI10NewObjectVEP7_JNIEnvP7_jclassP10_jmethodIDSt9__va_list+600)
11-29 18:45:18.793 F/art (13130): art/runtime/java_vm_ext.cc:470] native: #5 pc 00080e4b /data/app/com.jeremias.tv_online_univ-1/lib/arm/libcdp_sdk.so (???)
11-29 18:45:18.793 F/art (13130): art/runtime/java_vm_ext.cc:470] native: #6 pc 00080d31 /data/app/com.jeremias.tv_online_univ-1/lib/arm/libcdp_sdk.so (???)
11-29 18:45:18.793 F/art (13130): art/runtime/java_vm_ext.cc:470] native: #7 pc 000e0445 /data/app/com.jeremias.tv_online_univ-1/lib/arm/libcdp_sdk.so (Java_com_microsoft_connecteddevices_PlatformInternal_initializeInternal+652)
11-29 18:45:18.793 F/art (13130): art/runtime/java_vm_ext.cc:470] native: #8 pc 000e5c17 /data/app/com.jeremias.tv_online_univ-1/oat/arm/base.odex (Java_com_microsoft_connecteddevices_PlatformInternal_initializeInternal__Landroid_content_Context_2Lcom_microsoft_connecteddevices_IWebAccountProvider_2Ljava_lang_String_2Ljava_lang_String_2+170)
11-29 18:45:18.793 F/art (13130): art/runtime/java_vm_ext.cc:470] at com.microsoft.connecteddevices.PlatformInternal.initializeInternal(Native method)
11-29 18:45:18.793 F/art (13130): art/runtime/java_vm_ext.cc:470] at com.microsoft.connecteddevices.PlatformInternal.initialize(PlatformInternal.java:71)
11-29 18:45:18.793 F/art (13130): art/runtime/java_vm_ext.cc:470] at com.microsoft.connecteddevices.Platform$2.onDone(Platform.java:160)
11-29 18:45:18.793 F/art (13130): art/runtime/java_vm_ext.cc:470] at com.microsoft.connecteddevices.Platform$AccessTokenRefresher$AccessTokensFetchTask.run(Platform.java:630)
11-29 18:45:18.793 F/art (13130): art/runtime/java_vm_ext.cc:470] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
11-29 18:45:18.793 F/art (13130): art/runtime/java_vm_ext.cc:470] at java.util.concurrent.FutureTask.run(FutureTask.java:237)
11-29 18:45:18.793 F/art (13130): art/runtime/java_vm_ext.cc:470] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:272)
11-29 18:45:18.793 F/art (13130): art/runtime/java_vm_ext.cc:470] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
11-29 18:45:18.793 F/art (13130): art/runtime/java_vm_ext.cc:470] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
11-29 18:45:18.793 F/art (13130): art/runtime/java_vm_ext.cc:470] at java.lang.Thread.run(Thread.java:761)
11-29 18:45:18.793 F/art (13130): art/runtime/java_vm_ext.cc:470]
11-29 18:45:19.293 F/art (13130): art/runtime/runtime.cc:422] Runtime aborting...
11-29 18:45:19.293 F/art (13130): art/runtime/runtime.cc:422] Aborting thread:

What do you think that it may be the problem?
Thank you

@cmknox cmknox added xamarin Track all Xamarin related issues. and removed question labels May 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
xamarin Track all Xamarin related issues.
Projects
None yet
Development

No branches or pull requests

2 participants