[Mono-bugs] [Bug 655342] System.InvalidOperationException When Inheriting From IntentService

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Nov 22 15:13:17 EST 2010


https://bugzilla.novell.com/show_bug.cgi?id=655342

https://bugzilla.novell.com/show_bug.cgi?id=655342#c1


Jonathan Pryor <jpryor at novell.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |jpryor at novell.com
         Resolution|                            |INVALID

--- Comment #1 from Jonathan Pryor <jpryor at novell.com> 2010-11-22 20:13:16 UTC ---
Background:
  - Types which are listed within AndroidManifest.xml may be created by
Android.
  - Types with the [Activity], [BroadcastReceiver], 
    [ContentProvider], and [Service] attributes are inserted into the
    resulting AndroidManifest.xml file.
  - When Android creates one of these types, the default constructor is
invoked.
  - If the default constructor is not present, an error will be thrown and 
    the app will terminate.

Thus, there is a choice here:

 1. Generate an error if a type listed in AndroidManifest.xml doesn't have
    a default constructor.  This is the current behavior.

 2. Allow types with no default constructor to be present within 
    AndroidManifest.xml, and have Android throw an error later.

Obviously I like (1), but I'm willing to entertain (2).

As for Android.App.IntentService, the appropriate fix is to either:

 1. Remove the [Service] attribute from your MyIntentService type; or

 2. Provide a default constructor, and provide a value to the base constructor:

    [Service]
    public MyIntentService : IntentService {
        public MyIntentService ()
            : base ("worker-thread-name")
        {
        }
    }

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list