Bug 8213 - Download the app from Appstore, it was crashed when call the instance of ConstructorInfo
Summary: Download the app from Appstore, it was crashed when call the instance of Cons...
Status: RESOLVED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: 6.1.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-11-05 02:08 UTC by kenchell
Modified: 2012-11-06 21:20 UTC (History)
2 users (show)

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

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:
RESOLVED FIXED

Description kenchell 2012-11-05 02:08:08 UTC
I published my App to the Appstore and installed it,It was crashed when it invoke below codes:

private static Type[] _emptyArgument = new Type[0]; 
private static void InitXmlTypeInfo()
{
     ............
     ConstructorInfo defaultConstructor = type.GetConstructor(_emptyArgument);
     if (Object.ReferenceEquals(null, defaultConstructor))
       throw new TypeLoadException("Xmlable class should have a public default constructor! Modify your class: " + type.ToString());  // throw the exception, but there exist the default constructor,see below.
     ............
}


    [Xmlable("_Line", IsUnique = false)]
    public partial class _Line : Shape
    {
	public _Line()
	{

	}      
       
        public _Line(Point head, Point tail, Shape parent)
            : base(head, parent)
        {
            _head = head;
            _tail = tail;
        }
        ...........
   }

but when I published it to the 'Test Flight' and installed it, there is no problem.The App runs normally. The same to directly compile the app from macintosh to the iPad with mono touch. It is also no problem.
So I am very confused. Can you help me?
Comment 1 Sebastien Pouliot 2012-11-05 07:54:25 UTC
Please attach the full build logs (form MOnoDevelop's Error List Pad) for *both* your testlight build and appstore build.
Comment 2 kenchell 2012-11-06 21:20:09 UTC
hi, Sebastien Pouliot . 

Thank you for your quick response to my problem. I have fixed this issue yesterday by your cue.

when I built the program to the TestFlight ,I selected the behavior of Linker Options was 'Link SDK assemblies only'. but the different of building to Appstore ,I selected the 'Link all assemblies',
so I got the error.


And then I viewed the official document, such a description :

Link all assemblies 

When linking everything, the linker can use the whole set of its optimizations to make the application as small as possible. It will modify user code, which may break whenever the code uses features in a way that the linker's static analysis cannot detect. In such cases, e.g. webservices, reflection, or serialization, some adjustements might be required in your application to link everything.


Because my codes use the reflection technique, so I was wrong.


Once agan, thank you.