Bug 21616 - ClassNotFoundException using custom Exception types
Summary: ClassNotFoundException using custom Exception types
Status: CONFIRMED
Alias: None
Product: Android
Classification: Xamarin
Component: General (show other bugs)
Version: 4.12.4
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2014-07-25 20:34 UTC by David Schwegler
Modified: 2014-08-04 09:03 UTC (History)
2 users (show)

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


Attachments

Description David Schwegler 2014-07-25 20:34:32 UTC
Attempting to use a class that derives from a Java.Lang exception throws ClassNotFoundException.

1) Create a class that derives from a java exception class, e.g.

public class LoggingException : RuntimeException
{
	public LoggingException()
	{
	}
	public LoggingException(string detailMessage)
		: base(detailMessage)
	{
	}
}

2) Attempt to use it, e.g.

	new LoggingException("My message");

3) The app will crash as soon as it attempts to load the type.
Comment 1 Rajneesh Kumar 2014-07-28 06:56:36 UTC
I have checked this issue and I am able to reproduce this issue.

Steps I followed:

1. Crate an "Android Application" on XS
2. Create the following class 

public class LoggingException : RuntimeException
{
    public LoggingException()
    {
    }
    public LoggingException(string detailMessage)
        : base(detailMessage)
    {
    }
}

3. Initialize the "LoggingException" class

    new LoggingException("My message");

I observe that when I initialize the "LoggingException" class I am getting an "Java.Lang.NoClassDefFoundError".

Screencast: http://screencast.com/t/swoZds3K1Z

Application output: https://gist.github.com/anonymous/29c3fb7f7ef31b582101
Ide logs:

Environment Info:

=== Xamarin Studio ===

Version 5.3 (build 341)
Installation UUID: 474db917-e8f4-4d6a-a188-890200ead0e0
Runtime:
	Microsoft .NET 4.0.30319.18408
	GTK+ 2.24.22 (MS-Windows theme)
	GTK# 2.12.25

=== Xamarin.Android ===

Version: 4.12.6 (Trial Edition)
Android SDK: C:\Users\360 Logica\AppData\Local\Android\android-sdk
	Supported Android versions:
		2.1   (API level 7)
		2.2   (API level 8)
		2.3   (API level 10)
		3.1   (API level 12)
		4.0.3 (API level 15)
		4.3   (API level 18)
		4.4   (API level 19)
Java SDK: C:\Program Files\Java\jdk1.6.0_39
java version "1.6.0_39"
Java(TM) SE Runtime Environment (build 1.6.0_39-b04)
Java HotSpot(TM) Client VM (build 20.14-b01, mixed mode)

=== Build Information ===

Release ID: 503000341
Git revision: ad6fc654bba61b8f25f9f7290ea47547cceac2b3
Build date: 2014-07-23 04:56:26-04
Xamarin addins: 19c9a085cf5cfff3e113ff7e53a4d332604227ba

=== Operating System ===

Windows 6.2.9200.0
Comment 2 Jonathan Pryor 2014-08-04 09:03:16 UTC
Fixed in monodroid/b0f85970, and should be in the 4.16 beta series.

Note You need to log in before you can comment on or make changes to this bug.