Xamarin iOS app crash while horizontal scrolling back and forth - xamarin.ios

I have a controller that host scrollview. ScrollView behave like a pager. Every page is separate UIViewController. While I try to swipe very quickly back and forth the app crashes with following stacktrace
Thread 3 Crashed:
1 libobjc.A.dylib objc_msgSend + 16
2 App.IOS wrapper_managed_to_native_ObjCRuntime_Messaging_objc_msgSend_intptr_intptr_intptr_0 (<unknown>:1)
3 App.IOS Xamarin_iOS_CoreAnimation_CALayerDelegate_Dispose_bool (CALayerDelegate.cs:47)
4 App.IOS Xamarin_iOS_Foundation_NSObject_Finalize (NSObject2.cs:129)
5 App.IOS mscorlib_wrapper_runtime_invoke_object_runtime_invoke_virtual_void__this___object_intptr_intptr_intptr + 104
6 App.IOS mono_gc_run_finalize (gc.c:311)
7 App.IOS sgen_gc_invoke_finalizers (sgen-gc.c:2537)
8 App.IOS finalizer_thread (gc.c:885)
9 App.IOS start_wrapper (threads.c:829)
10 libsystem_pthread.dylib _pthread_body + 304
With following exception message
objc_msgSend() selector name: setDelegate:
As I understand it problem with GC. Anybody got any ideas why it happening ?

I found an answer. I was using 3rd party UI library with a Chart. On every switch of the screen (on view appear), I was updating a Chart with new Series, but before update had to clear previous Series.
Series.Clear();
So problem was that Series still was leaving in mono, but in objective-c they were dead and when GC happened it try to send a message to objective-c that have been already released. I will notify a library holding company about this bug.

Related

trouble using animate.translationXBy() function in android studio

I have written this code:
puckImg.animate().translationXBy(100).setDuration(300);
puckImg.animate().translationXBy(30).setDuration(2000);
puckImg.animate().translationXBy(90).setDuration(5000);
I am expecting my image view (puckImg) to first move by 100 in 300ms and then by another 30 for 2s and then another 90 for 5s.
but all that is happening is it is moving only by 90 for 5s. I am just not able to understand why that is happening. please help me.
is there any other way to do this step transition?
From the documentation:
translationXBy
Added in API level 12
public ViewPropertyAnimator translationXBy (float value)
This method will cause the View's translationX property to be animated by the specified value.
Animations already running on the property will be canceled.
As you can see, any animations running will be overridden by the latest animation of that same type. That's why only your last line of code is being run.
The code gets executed all at once, it doesn't wait 300 miliseconds and then goes to the next line.
You can use animation listener to execute what you want.

ESRI maps giving Main Thread Checker: UI API called on a background thread in iOS 11

I'm using ESRI maps in my application. When i run the application in iOS 10 there was no issue in loading the ESRI maps, zoom in and out works fine too. But when i run the same application with iOS 11 it gives me
Main Thread Checker: UI API called on a background thread: -[UIApplication
applicationState]
PID: 485, TID: 72091, Thread name: Runtime Network Callback Thread, Queue
name: com.apple.root.default-qos.overcommit, QoS: 21
Backtrace:
4 Altus Mobile 0x00000001006f4844 -
[AGSRequestOperation kickoffConnection] + 1108 .
5 Foundation 0x0000000185987a50 <redacted> + 340
6 CoreFoundation 0x0000000184f40358 <redacted> + 24
7 CoreFoundation 0x0000000184f402d8 <redacted> + 88
8 CoreFoundation 0x0000000184f3fb60 <redacted> + 204
9 CoreFoundation 0x0000000184f3d738 <redacted> + 1048
10 CoreFoundation 0x0000000184e5e2d8
CFRunLoopRunSpecific + 436
11 Foundation 0x00000001858866e4 <redacted> + 304
12 Altus Mobile 0x00000001007dbf28 -
[AGSThreadTargetImpl mainRoutine] + 292
13 Foundation 0x0000000185987860 <redacted> + 996
14 libsystem_pthread.dylib 0x0000000184bc432c <redacted> + 308
15 libsystem_pthread.dylib 0x0000000184bc41f8 <redacted> + 0
16 libsystem_pthread.dylib 0x0000000184bc2c38 thread_start + 4
2017-10-26 13:11:41.375952+0530 Altus Mobile[485:72091] [reports] Main
Thread Checker: UI API called on a background thread: -[UIApplication .
applicationState]
I know Apple has enable the Main Thead Checker in Latest Xcode version which tells if we use any UI Main Thread in background. Just to make sure the issue is with ESRI Maps have commented the loading part of ESRI maps, main thread checker issue didn't popped up, but when i uncommented it back, issue back again. Also when i zoom in and zoom out the ESRI map i'm getting
2017-10-26 13:11:41.659743+0530 Altus Mobile[485:72060] Task <504051EF-9770-
4852-AFB8-C47DF112DA52>.<30> finished with error - code: -999
Did anyone faced similar issue with ESRI maps? Any help is appreciated. Thank you.
Yes I was facing the same issue with ArcGIS SDK version 100.0.0 in iOS 11. Upgrading the ArcGIS SDK to 100.1.1 solved this issue for me.

IsolatedStorageSettings freeze UI thread WP8

in my app when a user logs in to skydrive and the status changes I am changing 4 settings in IsolatedStorageSettings.
It is done the same as http://msdn.microsoft.com/en-us/library/windowsphone/develop/ff769510(v=vs.105).aspx
When I modify these 4 values though my UI thread is freezing for a second or two as my progress bar gets choppy. I tried running it in a thread like so but still the same issue.
Thread ContactThread = new Thread(new ThreadStart(UpdateContact));
ContactThread.Start();

Actionscript - Flex mobile thread while loading data?

I am using Flash builder actionscript 3 Flex mobile.
I have a very heavy function that loads data from the local device and creates many graphic elements. While this function runs, the device freezes for 6 seconds or so.
I want to show a progress bar and let the device continue working, is there any way I can use threading to do this ? Other ideas are also welcome.
Thanks, Koby.
You know that at which function application getting freeze. Before that function call a progress bar. Create a progress bar in a pop up mode & call it. After 6 seconds(Not recommended) or getting the data just call removeallpopups() method. So now you can set the label in progress bar as "Loding..."
Sample code
<mx:ProgressBar id="sampleProgressBar" styleName="Calib16Blue"
indeterminate="true" labelPlacement="left"
label="{theMessage}"/>
Call this mxml by creating a pop up.
To do 'proper' muiltithreading you need to use the Worker Class (Documentation here), however the SQLConnection class and FileStream class have asynchronous methods that fit into the normal Actionscript event listener cycle and operate in "the background". Allowing the rest of the app to load when they're still pending.

Device Driver not calling Xxx_Init

I am just starting out with driver development, and am trying to initialize a device driver through the operating system on start up. The driver is for Windows Embedded CE 6.0.
I have been attempting to have my device send a message through a serial port to my PC whenever it gets initialized.
DWORD MYD_Init(LPCTSTR pContext, LPCVOID lpvBusContext)
{
DWORD dwResult = 1;
RETAILMSG(TRUE, (TEXT("MyDriver: Initializing!\n")));
DEBUGMSG(TRUE, (TEXT("MyDriver: Initializing!\n")));
return dwResult;
} //end MYD_Init
The DLLEntry function is gets called:
BOOL DllEntry(HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved)
{
switch (dwReason) {
case DLL_PROCESS_ATTACH:
RETAILMSG(TRUE, (TEXT("MyDriver - Process Attached\n")));
DEBUGMSG(TRUE, (TEXT("MyDriver - Process Attached\n")));
break;
case DLL_PROCESS_DETACH:
RETAILMSG(TRUE, (TEXT("MyDriver - Process Detached\n")));
DEBUGMSG(TRUE, (TEXT("MyDriver - Process Detached\n")));
break;
.......
default:
break;
} //end Switch
return TRUE;
} //end DllEntry
And here are a few lines from the serial port log:
FMD_Init: Blocks reserved for the bootloader/run-time image: 3124
I2C Driver: Intialization Started
MyDriver - Process AttachedMyDriver - Process DetachedTurn on clocks for Device block (in OTG_CTRL)
2589 CUSBFN::IsConfigurationSupportable
2593 CUSBFN::IsEndpointSupportable
2595 CUSBFN::IsEndpointSupportable
Line three shows that the driver gets loaded (I think), but MYD_Init is not called afterward. I'm not sure what I am missing. Maybe a missing reference from another file. My .def file includes the MYD_Init under EXPORTS. The .reg key is within the BuiltIn path: [HKEY_LOCAL_MACHINE\Drivers\BuiltIn\MyDriver]. Not sure if there are any others.
I guess my real question is what are possible things I am missing/forgetting to get the MYD_Init function to get called?
Thanks for any help you guys can provide to help me get this work!
Edit:
I have realized that the CreateFile function is never called and feel this is the reason for my problem. What are some steps that I could take to figure out where this function should be placed so that MYD_Init is not called before DllEntry?
Or maybe the ActivateDevice/ActiveDeviceEx functions? Does the OS automatically call these for the drivers listed under [HKEY_LOCAL_MACHINE\Drivers\BuiltIn], or do they have to be called manually?
Thanks again for any insight that can be provided!
Edit 2:
Here are the registry settings easily readable:
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\MyDriver]
"Prefix"="MYD"
"Dll"="myDriver.dll"
"Index"=dword:1
"Flags"=dword:0
Edit 3:
This is the output after trying to open the driver through an application:
USBFN: dwDeviceStatus: 0x11, m_fAttached: Attached
USBFN: dwDeviceStatus: 0x1, m_fAttached: Attached
MyDriver - Process Attached
MyDriver - Process Detached
COM_Open
COM_Open
IOCTL_SERIAL_SET_COMMTIMEOUTS (50,1,50,5,500)
IOCTL_SERIAL_SET_COMMTIMEOUTS (50,1,50,5,500)
IOCTL_SERIAL_SET_COMMTIMEOUTS (-1,0,0,2,500)
Testing Driver
MyDriver - Process Attached
MyDriver - Process Detached
Driver Tested
Line 3 and 4 is the Load attempt during system boot. The last four lines are output when the application to load the driver is run. "Testing Driver" and "Driver Tested" were placed at the beginning and end of the application.
Edit 4: Dumpbin Output
Dump of file myDriver.dll
File Type: DLL
Section contains the following exports for myDriver.dll
00000000 characteristics
501012DA time date stamp Wed Jul 25 10:38:02 2012
0.00 version
1 ordinal base
9 number of functions
9 number of names
ordinal hint RVA name
1 0 000013D4 DllEntry = DllEntry
2 1 00001348 MYD_Close = MYD_Close
3 2 0000130C MYD_Deinit = MYD_Deinit
4 3 000013B8 MYD_IOControl = MYD_IOControl
5 4 000012B8 MYD_Init = MYD_Init
6 5 00001328 MYD_Open = MYD_Open
7 6 00001364 MYD_Read = MYD_Read
8 7 0000139C MYD_Seek = MYD_Seek
9 8 00001380 MYD_Write = MYD_Write
Summary
1000 .data
1000 .pdata
1000 .reloc
1000 .text
Xxx_Init will be called when the driver is loaded. It might be loaded by calling ActivateDevice manually, or by having it automatically loaded by DeviceManager by setting the proper registry settings in [HKLM\Drivers\BuiltIn] (show us what keys you are using).
Xxx_Init is guaranteed to be called after DllEntry because DllEntry gets called when the DLL is loaded by the OS, which has to occur before Device Manager can load it.
CreateFile calls the Xxx_Open method in the driver, which is after all of these actions occur.
So the order of events is:
OS loads the DLL, calling DllEntry
Device Manager loads the driver (either manually or automatic), calling Xxx_Init
App opens the driver by calling CreateFile, which makes Device Manager call Xxx_Open
There are possibly some power management pieces that can fall at 2.5 on the list, but they are optional and likely unrelated to the issue you're seeing.
Typpically I'll use an explicit call to ActivateDevice/DeactivateDevice from a test app when first testing out driver bring-up. It lets you replace the driver DLL without having to reboot the system every time.
So the questions to you are:
If you manually call ActivateDevice from an app, what happens?
What are the registry keys you're currently using to try to get device manager to load the driver?

Resources