CodedValue object is missing Name property

672
2
Jump to solution
09-30-2021 11:57 AM
JoeHershman
MVP Regular Contributor

In 20+ years of programming I have seen some odd things, this may be the oddest.

This is for a Xamarin Forms app running on iOS.  Currently using 100.6 API

In our app we use domains as a bound property on Picker controls and use the Name as the display field.  All pretty straight forward stuff.   This is been working for ages without issue.

Recently we started to see an issue with the picker controls not loading.  After much investigation I came to notice in the debugger that the CodeValue objects only have a Code property no Name property.  It is just not there (see below).  If that was not strange enough.  It only happens on devices, if I run the application on the iOS simulator everything behaves as expected.  We see no errors, and as stated it is not that the Name property is empty, it is not on the object.  Also we see this on many different iOS versions from 14.3-15.0.  If I change the display property of the picker the control loads as expected, but the user has no idea what the codes mean

 

JoeHershman_0-1633027997545.png

 

Thanks,
-Joe
0 Kudos
1 Solution

Accepted Solutions
JoeHershman
MVP Regular Contributor

To add to Morten's information


@dotMorten_esri wrote:

The Name property is on the parent class. It just looks like the inspector window for some reason isn't showing the parent class. Or it could be the iOS Linker purging it if it isn't being used.


The issue does seem to be the iOS Linker.

The only place Name is used in the application is as a DisplayMemberPath in the control in Xaml.  This must not give the linker enough info.

I added this code which doesn't do anything besides using the Name property

if ( domain != null )
{
	foreach (var codedValue in domain.CodedValues)
	{
		Console.WriteLine(codedValue.Name);
	}
}

With this code added everything behaves correctly

 

Thanks,
-Joe

View solution in original post

0 Kudos
2 Replies
dotMorten_esri
Esri Notable Contributor

The Name property is on the parent class. It just looks like the inspector window for some reason isn't showing the parent class. Or it could be the iOS Linker purging it if it isn't being used.

JoeHershman
MVP Regular Contributor

To add to Morten's information


@dotMorten_esri wrote:

The Name property is on the parent class. It just looks like the inspector window for some reason isn't showing the parent class. Or it could be the iOS Linker purging it if it isn't being used.


The issue does seem to be the iOS Linker.

The only place Name is used in the application is as a DisplayMemberPath in the control in Xaml.  This must not give the linker enough info.

I added this code which doesn't do anything besides using the Name property

if ( domain != null )
{
	foreach (var codedValue in domain.CodedValues)
	{
		Console.WriteLine(codedValue.Name);
	}
}

With this code added everything behaves correctly

 

Thanks,
-Joe
0 Kudos