Probably you were caught by the linker. Reflection stuff is a liability.

http://docs.xamarin.com/android/advanced_topics/linking


On 22 August 2012 14:47, Francesco Colombo <[email protected]>wrote:

> Spot it!
>
> It was exactly what I was thinking. I've changed my code not using anymore
> the Activator. Now I'm explicitly using specific constructors.  All issues
> related to the release mode are solved!
>
> happy coding
> Francesco
>
>
>
> On Wed, Aug 22, 2012 at 3:29 PM, Francesco Colombo <
> [email protected]> wrote:
>
>> I'm thinking that this could be not an elegant solution because it can be
>> problematic when compilig using "Link SDK Assemblies" isn't it?
>>
>>
>> On Wed, Aug 22, 2012 at 3:27 PM, Francesco Colombo <
>> [email protected]> wrote:
>>
>>> Update
>>>
>>> I've just discovered that the app won't run also when running in Debug
>>> but without the mono shared runtime. I forgot to mention about this.
>>> Usually I debug apps using the shared mono runtime (for faster deploy).
>>>
>>> This code generate an exception (when Debug mode and no shared runtime)
>>>
>>>
>>>  TLayoutParameters lp =
>>>
>>> (TLayoutParameters)Activator.CreateInstance(typeof(TLayoutParameters),
>>> ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
>>>
>>> System.MissingMethodException: No constructor found for
>>> Android.Widget.RelativeLayout+LayoutParams::.ctor(System.Int32,
>>> System.Int32)
>>>   at System.Activator.CreateInstance
>>> (System.Type,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo,object[])
>>> <IL 0x0010c, 0x00750>
>>>   at System.Activator.CreateInstance (System.Type,object[],object[]) <IL
>>> 0x0000a, 0x0008f>
>>>   at System.Activator.CreateInstance (System.Type,object[]) <IL 0x00008,
>>> 0x00073>
>>>   at
>>> AdMaiora.Core.UI.ViewBuilder.ConfigureLayout<Android.Widget.RelativeLayout/LayoutParams>
>>> () <0x0011b>
>>>   at AdMaiora.Core.UI.MultiDatePickerDialog.SetContentLayout
>>> (Android.Content.Context) [0x00d7a]
>>>
>>> On Wed, Aug 22, 2012 at 3:04 PM, Francesco Colombo <
>>> [email protected]> wrote:
>>>
>>>> Hi,
>>>>
>>>> I'm done with the porting on Android of an app which run on iOS thanks
>>>> to MT.
>>>> All is fine, except that the app won't run when compiled in Release
>>>> mode.  It runs perfectly when compiled in Debug mode.
>>>>
>>>> I'm reporting these exceptions from the Android device output console.
>>>>
>>>> Exceptions are like these:
>>>>
>>>> E/mono    (22236): Unhandled Exception: System.MissingMethodException:
>>>> No constructor found for
>>>> Android.Widget.RelativeLayout+LayoutParams::.ctor(System.Int32,
>>>> System.Int32)
>>>> E/mono    (22236):   at System.Activator.CreateInstance (System.Type
>>>> type, BindingFlags bindingAttr, System.Reflection.Binder binder,
>>>> System.Object[] args, System.Globalization.CultureInfo culture,
>>>> System.Object[] activationAttributes) [0x00000] in <filename unknown>:0
>>>> E/mono    (22236):   at System.Activator.CreateInstance (System.Type
>>>> type, System.Object[] args, System.Object[] activationAttributes) [0x00000]
>>>> in <filename unknown>:0
>>>> E/mono    (22236):   at System.Activator.CreateInstance (System.Type
>>>> type, System.Object[] args) [0x00000] in <filename unknown>:0
>>>> E/mono    (22236):   at
>>>> AdMaiora.Core.UI.ViewBuilder.ConfigureLayout[LayoutParams] () [0x00000] in
>>>> <filename unknown>:0
>>>> E/mono    (22236):   at
>>>> AdMaiora.Core.UI.MultiDatePickerDialog.SetContentLayout
>>>> (Android.Content.Context context) [0x00000] in <filename unknown>:0
>>>> E/mono    (22236):   at AdMaiora.Core.UI.MultiDatePickerDialog..ctor
>>>> (Android.Content.Context context) [0x00000] in <filename unknown>:0
>>>>
>>>>
>>>> E/mono    (22267): Unhandled Exception: System.NullReferenceException:
>>>> Object reference not set to an instance of an object
>>>> E/mono    (22267):   at AdMaiora.Iusuite.UI.PhoneHomeActivity.OnResume
>>>> () [0x00000] in <filename unknown>:0
>>>> E/mono    (22267):   at Android.App.Activity.n_OnResume (IntPtr jnienv,
>>>> IntPtr native__this) [0x00000] in <filename unknown>:0
>>>> E/mono    (22267):   at (wrapper dynamic-method)
>>>> object:996ba38f-2daa-4926-b4ab-f0645f3c2cfd (intptr,intptr)
>>>>
>>>> The release mode app is currently being tested on a real device but has
>>>> been heavily tested on virtual devices (also the x86 version works, when in
>>>> debug mode)
>>>> The debug version works perfectly either on real device or virtual
>>>> devices.
>>>>
>>>> any idea?
>>>>
>>>> thanks
>>>> Francesco
>>>>
>>>>
>>>
>>
>
> _______________________________________________
> 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

Reply via email to