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)

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 for Bug 21616 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
CONFIRMED

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.