Just an idea, but maybe you could do something with T4 Templates?
this could give you some ideas:
<#@ template debug="false" hostspecific="false" language="C#" #>
<#@ assembly name="System.Core" #>
<#@ import namespace="System.Reflection" #>
<#@ import namespace="System.Collections.Generic" #>
<#@ output extension=".cs" #>
using System.Reflection;
public class KeepStuff
{
public void KeepStuffAgain()
{
PropertyInfo list = null;<#
foreach (PropertyInfo info in typeof(PropertyInfo).GetProperties())
{
#>
var value<#= info.Name #> = list.<#= info.Name #>;
<#
}
#>
}
}
Sent from my Windows 8 PC <http://windows.microsoft.com/consumer-preview>
*From:* Goncalo Oliveira <[email protected]>
*Sent:* 16 August 2012 10:48:09 AM
*To:* Discussions related to Mono for Android <[email protected]>
*Subject:* Re: [mono-android] Release version errors
Types and... properties... oh boy, that's gonna be fun!
Well that or... turn off linking on Mono.Android and get a 18mb file.
There should be a way of doing this without all this hassle. At least for a
type's properties. If at least there was a way to teach the linker which
types to preserve and have ALL it's properties preserved, it wouldn't be so
bad.
Cheers.
On 16 August 2012 06:09, Meinrad Recheis <[email protected]> wrote:
> Your only option seems to be to completely specialize this routine into a
> switch statement that handles all possible types :-/
> -- MR
>
>
> On 14.08.2012 11:26, Goncalo Oliveira wrote:
>
> I'm kind of lost here. I've found exactly what's failing and where. I have
> some code that's basically trying to do this:
>
> Type targetType = Target.GetType(); // type is Android.Widget.Spinner
> PropertyInfo getterProperty = targetType.GetProperty( getterPath );
>
> In release getterProperty is returning null. Seems like the linker is
> excluding the property, or at least, that is my understanding.
> As you stated, I have no code, so "Preserve" is not available. Also this
> is dynamic and target type could be an EditText or something else. How
> exactly can I implement the falseflag method here?
>
> Cheers
>
>
>
> On 26 July 2012 03:55, Jonathan Pryor <[email protected]> wrote:
>
>> On Jul 24, 2012, at 5:45 AM, Goncalo Oliveira <[email protected]> wrote:
>> > Let me see if I get this straight. I do have an additional project that
>> is referenced by the application. It's basically the data model classes. I
>> need to add the "[Android.Runtime.Preserve(AllMembers=true)]" attribute to
>> the classes in this assembly in order to avoid the linker to "eat up" its
>> references? Either that or the weird falseflag method?
>>
>> Generally you should start with "Link SDK Assemblies". Using the "Link
>> All Assemblies" option is for the insane.
>>
>> If Link SDK Assemblies fails, it's generally because the linker isn't
>> smart enough to preserve SDK members that you're using. Using [Preserve]
>> won't help (no source!), so you'd want to use falsflag or linkskip.
>>
>> - Jon
>>
>> _______________________________________________
>> Monodroid mailing list
>> [email protected]
>>
>> UNSUBSCRIBE INFORMATION:
>> http://lists.ximian.com/mailman/listinfo/monodroid
>>
>
>
>
> --
> Gonçalo Oliveira
>
>
> _______________________________________________
> Monodroid mailing [email protected]
>
> UNSUBSCRIBE INFORMATION:http://lists.ximian.com/mailman/listinfo/monodroid
>
>
> _______________________________________________
> Monodroid mailing list
> [email protected]
>
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/mailman/listinfo/monodroid
>
>
--
Gonçalo Oliveira
_______________________________________________
Monodroid mailing list
[email protected]
UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid
_______________________________________________
Monodroid mailing list
[email protected]
UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid