Bug 21624 - oData - Populating a DataServiceCollection generates an error when there is a DateTime value which is null.
Summary: oData - Populating a DataServiceCollection generates an error when there is a...
Status: VERIFIED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: 7.2.6
Hardware: All All
: Normal normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-07-27 05:55 UTC by Anthony
Modified: 2014-07-30 10:15 UTC (History)
5 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Xamarin.Forms app which illustrates the bug (81.37 KB, application/x-zip-compressed)
2014-07-27 05:55 UTC, Anthony
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
VERIFIED FIXED

Description Anthony 2014-07-27 05:55:17 UTC
Created attachment 7501 [details]
Xamarin.Forms app which illustrates the bug

It appears that DateTime values which are null generate the following error only on iOS:
Non-static method requires a target.

Android does not experience this issue, and properly loads the data.

nBelow is an excerpt from the attached sample project which illustrates the
issue.

	var context = new DatabaseEntities(new Uri(_serviceURI));

	var collection = new DataServiceCollection<Customer>(context);

	// Loading data that contains a null DateTime throws the following exception only on iOS
	// Non-static method requires a target.

	// It appears to be occuring internally in 
	// System.Data.Services.Client.Metadata.ClientPropertyAnnotation.SetValue() method
	// On the line that performs a 
	// this.propertySetter.Invoke(instance, value);

	collection.LoadCompleted += (sender, args) =>
	{
		if (args.Error != null)
		{
			exceptionAction(args.Error.InnerException ?? args.Error);
		}

		var responseCollection = sender as DataServiceCollection<Customer>;

		successAction(responseCollection);
	};

	collection.LoadAsync(context.Customers);

Thanks :)
Comment 1 Rolf Bjarne Kvinge [MSFT] 2014-07-28 03:43:58 UTC
Can you get your version information from Xamarin Studio's About menu (click on the "Details" button)?
Comment 2 Anthony 2014-07-28 05:56:55 UTC
***************
****From PC****
***************
Xamarin Studio
Version 5.2 (build 384)
Installation UUID: 1d8a9232-d5d6-4d00-b378-e7d7d3ad6ebf
Runtime:
	Microsoft .NET 4.0.30319.34014
	GTK+ 2.24.22 (MS-Windows theme)
	GTK# 2.12.25

Xamarin.Android
Version: 4.14.0 (Business Edition)
Android SDK: C:\Users\Anthony\AppData\Local\Android\android-sdk
	Supported Android versions:
		2.1   (API level 7)
		2.2   (API level 8)
		2.3   (API level 10)
		3.1   (API level 12)
		4.0.3 (API level 15)
		4.3   (API level 18)
		4.4   (API level 19)
Java SDK: C:\Program Files (x86)\Java\jdk1.6.0_39
java version "1.6.0_39"
Java(TM) SE Runtime Environment (build 1.6.0_39-b04)
Java HotSpot(TM) Client VM (build 20.14-b01, mixed mode, sharing)

Build Information
Release ID: 502000384
Git revision: 09e06441e39ea272ddda63758fd53013157f7e45
Build date: 2014-07-16 11:19:35-04
Xamarin addins: 2d11dd4dad5b35ca83f24d70e965792a47be8291

Operating System
Windows 6.2.9200.0 (64-bit)

****************
****From MAC****
****************
=== Xamarin Studio ===

Version 5.2 (build 384)
Installation UUID: d3d371be-7555-4c87-9f17-b87fabd08180
Runtime:
	Mono 3.6.0 ((no/f540f8a)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 306000039

=== Apple Developer Tools ===

Xcode 5.1.1 (5085)
Build 5B1008

=== Xamarin.Android ===

Version: 4.14.0 (Business Edition)
Android SDK: /Users/Anthony/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.1   (API level 7)
		2.2   (API level 8)
		2.3   (API level 10)
		3.1   (API level 12)
		4.0.3 (API level 15)
		4.4   (API level 19)
Java SDK: /usr
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)

=== Xamarin.iOS ===

Version: 7.2.6.26 (Business Edition)
Hash: f10e5ed
Branch: 
Build date: 2014-07-23 11:06:08-0400

=== Xamarin.Mac ===

Version:

=== Build Information ===

Release ID: 502000384
Git revision: 09e06441e39ea272ddda63758fd53013157f7e45
Build date: 2014-07-16 11:15:54-04
Xamarin addins: 2d11dd4dad5b35ca83f24d70e965792a47be8291

=== Operating System ===

Mac OS X 10.9.4
Darwin macmini.home 13.3.0 Darwin Kernel Version 13.3.0
    Tue Jun  3 21:27:35 PDT 2014
    root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64
Comment 3 Udham Singh 2014-07-28 06:55:10 UTC
I have checked this issue and observed that for iOS we are getting error
"Non-static method requires a target", while this is working fine for android.
To reproduce this issue I have run the sample application attached in bug
description and debug the code.

Screencast : 

For Windows : http://www.screencast.com/t/eYDwRzwoO
For Mac : http://screencast.com/t/f0UD8duaadz

Note : I have checked this issue on both windows and mac, getting same behavior
on both mac and windows.

Environment Info : 

For windows:

Windows 8.1
VS 2013
Xamarin 3.1.228.0
Xamarin.iOS Build Host 7.2.5.5
Xcode 5.1

**********************************************
For Mac:

=== Xamarin Studio ===

Version 5.1.4 (build 0)
Installation UUID: 011d70a5-dede-428b-ab04-ef451c2e539d
Runtime:
 Mono 3.4.0 ((no/954ed3c)
 GTK+ 2.24.23 (Raleigh theme)

 Package version: 304000214

=== Xamarin.Android ===

Version: 4.12.6 (Indie Edition)
Android SDK: /Users/MM/Desktop/android-sdk-macosx
 Supported Android versions:
  2.1   (API level 7)
  2.2   (API level 8)
  2.3   (API level 10)
  3.1   (API level 12)
  3.2   (API level 13)
  4.0   (API level 14)
  4.0.3 (API level 15)
  4.1   (API level 16)
  4.2   (API level 17)
  4.3   (API level 18)
  4.4   (API level 19)
Java SDK: /usr
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)

=== Apple Developer Tools ===

Xcode 5.1 (5084)
Build 5B130a

=== Xamarin.iOS ===

Version: 7.2.5.5 (Trial Edition)
Hash: 87026b6
Branch: 
Build date: 2014-07-02 19:39:08-0400

=== Xamarin.Mac ===

Version:

=== Build Information ===

Release ID: 501040000
Git revision: 7d45bbe2ee22625f125d0c52548524f02d005cca
Build date: 2014-07-14 12:15:53-04
Xamarin addins: c78f1d88e57baa928aeee1484d96e6f8edf8de33

=== Operating System ===

Mac OS X 10.9.2
Darwin MacMini.local 13.1.0 Darwin Kernel Version 13.1.0
    Thu Jan 16 19:40:37 PST 2014
    root:xnu-2422.90.20~2/RELEASE_X86_64 x86_64
Comment 4 Sebastien Pouliot 2014-07-28 16:41:52 UTC
This works fine for me when I use master - so it's likely already fixed in mono (and will be part of the XI release after 7.2.6). 

I'll try this again on 7.2.6 to be sure since IIRC Xamarin.Android 4.14 should be using the same mono versions (as XI 7.2.6).
Comment 5 Sebastien Pouliot 2014-07-28 17:03:31 UTC
@Anthony are you sure you used 7.2.6.26 (beta) originally ?

Your sample works fine for me and Udham got the same using 7.2.5 (which would have an older mono, not the one XA 4.14 uses).

@Udham can you test again with 7.2.6 ?
Comment 6 Anthony 2014-07-29 07:06:07 UTC
Hi @Sebastien!

I'm very happy to report that this is *working* on 7.2.6.26.  I updated to the beta right after creating this bug.  

I believe I have another issue but I'll troubleshoot some more before posting a bug.

Thanks so much for your super fast response!  It's greatly appreciated :)

Take care,
Ant
Comment 7 Udham Singh 2014-07-30 10:15:53 UTC
I have checked this issue with Xamarin.iOS 7.2.6.26 and this is working fine.

Screencast : http://screencast.com/t/UsVpb4j2

Environment Info :

For windows:

Windows 8.1
VS 2013
Xamarin 3.1.228.0
Xamarin.iOS Build Host 7.2.6.26
Xcode 5.1

**********************************************
For Mac:

=== Xamarin Studio ===

Version 5.1.4 (build 0)
Installation UUID: 011d70a5-dede-428b-ab04-ef451c2e539d
Runtime:
	Mono 3.4.0 ((no/954ed3c)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 304000214

=== Xamarin.Android ===

Version: 4.12.6 (Enterprise Edition)
Android SDK: /Users/MM/Desktop/android-sdk-macosx
	Supported Android versions:
		2.1   (API level 7)
		2.2   (API level 8)
		2.3   (API level 10)
		3.1   (API level 12)
		3.2   (API level 13)
		4.0   (API level 14)
		4.0.3 (API level 15)
		4.1   (API level 16)
		4.2   (API level 17)
		4.3   (API level 18)
		4.4   (API level 19)
Java SDK: /usr
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)

=== Apple Developer Tools ===

Xcode 5.1 (5084)
Build 5B130a

=== Xamarin.iOS ===

Version: 7.2.6.26 (Enterprise Edition)
Hash: f10e5ed
Branch: 
Build date: 2014-07-23 11:06:08-0400

=== Xamarin.Mac ===

Version: 1.10.0.3 (Enterprise Edition)

=== Build Information ===

Release ID: 501040000
Git revision: 7d45bbe2ee22625f125d0c52548524f02d005cca
Build date: 2014-07-14 12:15:53-04
Xamarin addins: c78f1d88e57baa928aeee1484d96e6f8edf8de33

=== Operating System ===

Mac OS X 10.9.2
Darwin MacMini.local 13.1.0 Darwin Kernel Version 13.1.0
    Thu Jan 16 19:40:37 PST 2014
    root:xnu-2422.90.20~2/RELEASE_X86_64 x86_64