Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to inflate a layout which has custom controls with mixed naming casing and is included through a library project reference #1711

Closed
pjcollins opened this issue May 21, 2018 · 3 comments
Assignees
Labels
Area: App Runtime Issues in `libmonodroid.so`. vs-sync For internal use only; creates a VSTS "mirror" issue.
Milestone

Comments

@pjcollins
Copy link
Member

pjcollins commented May 21, 2018

A regression test related to https://bugzilla.xamarin.com/show_bug.cgi?id=23880 is failing against master (d15-8). Attempting to inflate a layout with some custom controls using different namespace casing from a library project is no longer successful. this is a regression from d15-7.

Steps to Reproduce

  1. Download and run the attached project on device.

CustomControl.zip

Expected Behavior

Inflating layouts with mixed cased custom control declarations works regardless of which project the layout belongs to.

Actual Behavior

05-21 18:31:12.620 15267 15267 E mono-rt : [ERROR] FATAL UNHANDLED EXCEPTION: Android.Views.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class classlibrary1.CustomTextView ---> Android.Views.InflateException: Binary XML file line #1: Error inflating class classlibrary1.CustomTextView ---> Java.Lang.ClassNotFoundException: Didn't find class "classlibrary1.CustomTextView" on path: DexPathList[[zip file "/data/app/CustomControl.CustomControl-1/base.apk"],nativeLibraryDirectories=[/data/app/CustomControl.CustomControl-1/lib/arm64, /system/fake-libs64, /data/app/CustomControl.CustomControl-1/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]
05-21 18:31:12.620 15267 15267 E mono-rt :    --- End of inner exception stack trace ---
05-21 18:31:12.620 15267 15267 E mono-rt :    --- End of inner exception stack trace ---
05-21 18:31:12.620 15267 15267 E mono-rt :   at (wrapper dynamic-method) System.Object.6aa6b78e-e820-4a0d-af04-cae4655c198e(intptr,intptr,intptr)
05-21 18:31:12.620 15267 15267 E mono-rt :   --- End of managed Android.Views.InflateException stack trace ---
05-21 18:31:12.620 15267 15267 E mono-rt : android.view.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class classlibrary1.CustomTextView
05-21 18:31:12.620 15267 15267 E mono-rt : Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class classlibrary1.CustomTextView
05-21 18:31:12.620 15267 15267 E mono-rt : Caused by: java.lang.ClassNotFoundException: Didn't find class "classlibrary1.CustomTextView" on path: DexPathList[[zip file "/data/app/CustomControl.CustomControl-1/base.apk"],nativeLibraryDirectories=[/data/app/CustomControl.CustomControl-1/lib/arm64, /system/fake-libs64, /data/app/CustomControl.CustomControl-1/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]
05-21 18:31:12.620 15267 15267 E mono-rt :      at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
05-21 18:31:12.620 15267 15267 E mono-rt :      at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
05-21 18:31:12.620 15267 15267 E mono-rt :      at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
05-21 18:31:12.620 15267 15267 E mono-rt :      at android.view.LayoutInflater.createView(LayoutInflater.java:609)
05-21 18:31:12.620 15267 15267 E mono-rt :      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787)
05-21 18:31:12.620 15267 15267 E mono-rt :      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
05-21 18:31:12.620 15267 15267 E mono-rt :      at android.view.LayoutInflater.rInflate(LayoutInflater.java:858)
05-21 18:31:12.620 15267 15267 E mono-rt :      at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
05-21 18:31:12.620 15267 15267 E mono-rt :      at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
05-21 18:31:12.620 15267 15267 E mono-rt :      at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
05-21 18:31:12.620 15267 15267 E mono-rt :      at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
05-21 18:31:12.620 15267 15267 E mono-rt :      at md55a979b20f205572c4e768e1416c32f1f.MainActivity.n_onCreate(Native Method)
05-21 18:31:12.620 15267 15267 E mono-rt :      at md55a979b20f205572c4e768e1416c32f1f.MainActivity.onCreate(MainActivity.java:29)
05-21 18:31:12.620 15267 15267 E mono-rt :      at android.app.Activity.performCreate(Activity.java:6682)
05-21 18:31:12.620 15267 15267 E mono-rt :      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
05-21 18:31:12.620 15267 15267 E mono-rt :      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2619)
05-21 18:31:12.620 15267 15267 E mono-rt :      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2727)
05-21 18:31:12.620 15267 15267 E mono-rt :      at android.app.ActivityThread.-wrap12(ActivityThread.java)
05-21 18:31:12.620 15267 15267 E mono-rt :      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1478)
05-21 18:31:12.620 15267 15267 E mono-rt :      at android.os.Handler.dispatchMessage(Handler.java:102)
05-21 18:31:12.620 15267 15267 E mono-rt :      at android.os.Looper.loop(Looper.java:154)
05-21 18:31:12.620 15267 15267 E mono-rt :      at android.app.ActivityThread.main(ActivityThread.java:6121)
05-21 18:31:12.620 15267 15267 E mono-rt :      at java.lang.reflect.Method.invoke(Native Method)
05-21 18:31:12.620 15267 15267 E mono-rt :      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
05-21 18:31:12.620 15267 15267 E mono-rt :      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)

Version Information

monodroid/master/de662f58.

VS bug #619948

@pjcollins pjcollins added Area: App Runtime Issues in `libmonodroid.so`. regression labels May 21, 2018
@pjcollins pjcollins added this to the d15-8 milestone May 21, 2018
@pjcollins
Copy link
Member Author

Seemingly related, the regression test for https://bugzilla.xamarin.com/show_bug.cgi?id=23167 is also now failing against d15-8. The Library project XML in this test case is not updated after building:

Expected:

<md550ea669608a313e95b5e9acf6457423f.MyView android:id="@+id/myView" android:layout_width="fill_parent" android:layout_height="wrap_content" /></LinearLayout>

Actual:

<Scratch.Views.MyView android:id="@+id/myView" android:layout_width="fill_parent" android:layout_height="wrap_content" />

@jonpryor jonpryor added the vs-sync For internal use only; creates a VSTS "mirror" issue. label May 21, 2018
@jonpryor
Copy link
Member

What'd odd to me is my diagnostic build output:

  ConvertResourcesCases Task (TaskId:104)
    ResourceDirectories: obj/Debug/res/ (TaskId:104)
    AcwMapFile: obj/Debug/acw-map.txt (TaskId:104)
    AndroidConversionFlagFile: obj/Debug/R.cs.flag (TaskId:104)
    AndroidResgenFlagFile modified: 1/1/0001 12:00:00 AM (TaskId:104)
    Processing: obj/Debug/res/layout/custom_text.xml   5/21/2018 3:28:18 PM > 1/1/0001 12:00:00 AM (TaskId:104)
...

I find this odd because I don't have a obj/Debug/res/layout/custom_text.xml file:

$ find obj -name custom_te\*
obj/Debug/lp/0/jl/res/layout/custom_text.xml

Additionally, the above file is "badly formatted" -- implying it's been hit by a tool, as everything is on one line -- but the elements haven't been properly fixed up:

<LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android"><classlibrary1.CustomTextView android:id="@+id/myText1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="namespace_lower" /><ClassLibrary1.CustomTextView android:id="@+id/myText2" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="namespace_proper" /></LinearLayout>

Manually formatting that:

<LinearLayout
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    xmlns:android="http://schemas.android.com/apk/res/android">
  <classlibrary1.CustomTextView
      android:id="@+id/myText1"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:text="namespace_lower"
    />
    <ClassLibrary1.CustomTextView
      android:id="@+id/myText2"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:text="namespace_proper"
    />
</LinearLayout>

This is messed up. :-(

obj/Debug/acw-map.txt, meanwhile, looks sane:

ClassLibrary1.CustomTextView, ClassLibrary1;md5d6f7135293df7527c983d45d07471c5e.CustomTextView
ClassLibrary1.CustomTextView;md5d6f7135293df7527c983d45d07471c5e.CustomTextView
classlibrary1.CustomTextView;md5d6f7135293df7527c983d45d07471c5e.CustomTextView

@dellis1972
Copy link
Contributor

PR is up #1718.

dellis1972 added a commit to dellis1972/xamarin-android that referenced this issue May 23, 2018
…e fixed up.

Context dotnet#1711

When using a custom view within a layout file we replace the
`namespace.classname` with an `md5hash.classname`. We do this
by using the `acwmap.txt` file to make known types onto the
`md5` hashed ones. We do this in a case sensitive manner. We
also only support Camel case and lower case type names.

	ClassLibrary1.CustomView=md5d6f7135293df7527c983d45d07471c5e.CustomTextView
	classlibrary1.CustomView=md5d6f7135293df7527c983d45d07471c5e.CustomTextView

Given that a user is able to type these manually it is highly
probable that typo's will occur. If for example a user types

	Classlibrary1.CustomView

this will NOT be fixed up. Instead the user will recieve the
following error at runtime.

	FATAL UNHANDLED EXCEPTION: Android.Views.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class Classlibrary1.CustomTextView ---> Android.Views.InflateException: Binary XML file line #1: Error inflating class Classlibrary1.CustomTextView ---> Java.Lang.ClassNotFoundException: Didn't find class "Classlibrary1.CustomTextView"

if you are using the control in a number of places this runtime error
does nothing to help track down the problem.

Instead what we should be doing is detecting these issues and emitting
a build error. This will provide the user not only the problem but
also a link to the file causing the probem.

TODO
----

[ ] Fix up the name so it points to the file in `Resources` not `res`
[ ] Add a Unit test.
[ ] Add Error code and document.
dellis1972 added a commit to dellis1972/xamarin-android that referenced this issue Jun 18, 2018
…e fixed up.

Context dotnet#1711

When using a custom view within a layout file we replace the
`namespace.classname` with an `md5hash.classname`. We do this
by using the `acwmap.txt` file to make known types onto the
`md5` hashed ones. We do this in a case sensitive manner. We
also only support Camel case and lower case type names.

	ClassLibrary1.CustomView=md5d6f7135293df7527c983d45d07471c5e.CustomTextView
	classlibrary1.CustomView=md5d6f7135293df7527c983d45d07471c5e.CustomTextView

Given that a user is able to type these manually it is highly
probable that typo's will occur. If for example a user types

	Classlibrary1.CustomView

this will NOT be fixed up. Instead the user will recieve the
following error at runtime.

	FATAL UNHANDLED EXCEPTION: Android.Views.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class Classlibrary1.CustomTextView ---> Android.Views.InflateException: Binary XML file line #1: Error inflating class Classlibrary1.CustomTextView ---> Java.Lang.ClassNotFoundException: Didn't find class "Classlibrary1.CustomTextView"

if you are using the control in a number of places this runtime error
does nothing to help track down the problem.

Instead what we should be doing is detecting these issues and emitting
a build error. This will provide the user not only the problem but
also a link to the file causing the probem.

TODO
----

[ ] Fix up the name so it points to the file in `Resources` not `res`
[ ] Add a Unit test.
[ ] Add Error code and document.
dellis1972 added a commit to dellis1972/xamarin-android that referenced this issue Jun 29, 2018
…e fixed up.

Context dotnet#1711

When using a custom view within a layout file we replace the
`namespace.classname` with an `md5hash.classname`. We do this
by using the `acwmap.txt` file to make known types onto the
`md5` hashed ones. We do this in a case sensitive manner. We
also only support Camel case and lower case type names.

	ClassLibrary1.CustomView=md5d6f7135293df7527c983d45d07471c5e.CustomTextView
	classlibrary1.CustomView=md5d6f7135293df7527c983d45d07471c5e.CustomTextView

Given that a user is able to type these manually it is highly
probable that typo's will occur. If for example a user types

	Classlibrary1.CustomView

this will NOT be fixed up. Instead the user will recieve the
following error at runtime.

	FATAL UNHANDLED EXCEPTION: Android.Views.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class Classlibrary1.CustomTextView ---> Android.Views.InflateException: Binary XML file line #1: Error inflating class Classlibrary1.CustomTextView ---> Java.Lang.ClassNotFoundException: Didn't find class "Classlibrary1.CustomTextView"

if you are using the control in a number of places this runtime error
does nothing to help track down the problem.

Instead what we should be doing is detecting these issues and emitting
a build error. This will provide the user not only the problem but
also a link to the file causing the probem.

TODO
----

[ ] Fix up the name so it points to the file in `Resources` not `res`
[ ] Add a Unit test.
[ ] Add Error code and document.
dellis1972 added a commit to dellis1972/xamarin-android that referenced this issue Jul 5, 2018
…e fixed up.

Context dotnet#1711

When using a custom view within a layout file we replace the
`namespace.classname` with an `md5hash.classname`. We do this
by using the `acwmap.txt` file to make known types onto the
`md5` hashed ones. We do this in a case sensitive manner. We
also only support Camel case and lower case type names.

	ClassLibrary1.CustomView=md5d6f7135293df7527c983d45d07471c5e.CustomTextView
	classlibrary1.CustomView=md5d6f7135293df7527c983d45d07471c5e.CustomTextView

Given that a user is able to type these manually it is highly
probable that typo's will occur. If for example a user types

	Classlibrary1.CustomView

this will NOT be fixed up. Instead the user will recieve the
following error at runtime.

	FATAL UNHANDLED EXCEPTION: Android.Views.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class Classlibrary1.CustomTextView ---> Android.Views.InflateException: Binary XML file line #1: Error inflating class Classlibrary1.CustomTextView ---> Java.Lang.ClassNotFoundException: Didn't find class "Classlibrary1.CustomTextView"

if you are using the control in a number of places this runtime error
does nothing to help track down the problem.

Instead what we should be doing is detecting these issues and emitting
a build error. This will provide the user not only the problem but
also a link to the file causing the probem.

TODO
----

[ ] Fix up the name so it points to the file in `Resources` not `res`
[ ] Add a Unit test.
[ ] Add Error code and document.
dellis1972 added a commit to dellis1972/xamarin-android that referenced this issue Jul 17, 2018
…e fixed up.

Context dotnet#1711

When using a custom view within a layout file we replace the
`namespace.classname` with an `md5hash.classname`. We do this
by using the `acwmap.txt` file to make known types onto the
`md5` hashed ones. We do this in a case sensitive manner. We
also only support Camel case and lower case type names.

	ClassLibrary1.CustomView=md5d6f7135293df7527c983d45d07471c5e.CustomTextView
	classlibrary1.CustomView=md5d6f7135293df7527c983d45d07471c5e.CustomTextView

Given that a user is able to type these manually it is highly
probable that typo's will occur. If for example a user types

	Classlibrary1.CustomView

this will NOT be fixed up. Instead the user will recieve the
following error at runtime.

	FATAL UNHANDLED EXCEPTION: Android.Views.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class Classlibrary1.CustomTextView ---> Android.Views.InflateException: Binary XML file line #1: Error inflating class Classlibrary1.CustomTextView ---> Java.Lang.ClassNotFoundException: Didn't find class "Classlibrary1.CustomTextView"

if you are using the control in a number of places this runtime error
does nothing to help track down the problem.

Instead what we should be doing is detecting these issues and emitting
a build error. This will provide the user not only the problem but
also a link to the file causing the probem.

TODO
----

[ ] Fix up the name so it points to the file in `Resources` not `res`
[ ] Add a Unit test.
[ ] Add Error code and document.
dellis1972 added a commit to dellis1972/xamarin-android that referenced this issue Jul 18, 2018
…e fixed up.

Context dotnet#1711

When using a custom view within a layout file we replace the
`namespace.classname` with an `md5hash.classname`. We do this
by using the `acwmap.txt` file to make known types onto the
`md5` hashed ones. We do this in a case sensitive manner. We
also only support Camel case and lower case type names.

	ClassLibrary1.CustomView=md5d6f7135293df7527c983d45d07471c5e.CustomTextView
	classlibrary1.CustomView=md5d6f7135293df7527c983d45d07471c5e.CustomTextView

Given that a user is able to type these manually it is highly
probable that typo's will occur. If for example a user types

	Classlibrary1.CustomView

this will NOT be fixed up. Instead the user will recieve the
following error at runtime.

	FATAL UNHANDLED EXCEPTION: Android.Views.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class Classlibrary1.CustomTextView ---> Android.Views.InflateException: Binary XML file line #1: Error inflating class Classlibrary1.CustomTextView ---> Java.Lang.ClassNotFoundException: Didn't find class "Classlibrary1.CustomTextView"

if you are using the control in a number of places this runtime error
does nothing to help track down the problem.

Instead what we should be doing is detecting these issues and emitting
a build error. This will provide the user not only the problem but
also a link to the file causing the probem.

TODO
----

[ ] Fix up the name so it points to the file in `Resources` not `res`
[ ] Add a Unit test.
[ ] Add Error code and document.
dellis1972 added a commit to dellis1972/xamarin-android that referenced this issue Jul 31, 2018
…e fixed up.

Context dotnet#1711

When using a custom view within a layout file we replace the
`namespace.classname` with an `md5hash.classname`. We do this
by using the `acwmap.txt` file to make known types onto the
`md5` hashed ones. We do this in a case sensitive manner. We
also only support Camel case and lower case type names.

	ClassLibrary1.CustomView=md5d6f7135293df7527c983d45d07471c5e.CustomTextView
	classlibrary1.CustomView=md5d6f7135293df7527c983d45d07471c5e.CustomTextView

Given that a user is able to type these manually it is highly
probable that typo's will occur. If for example a user types

	Classlibrary1.CustomView

this will NOT be fixed up. Instead the user will recieve the
following error at runtime.

	FATAL UNHANDLED EXCEPTION: Android.Views.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class Classlibrary1.CustomTextView ---> Android.Views.InflateException: Binary XML file line #1: Error inflating class Classlibrary1.CustomTextView ---> Java.Lang.ClassNotFoundException: Didn't find class "Classlibrary1.CustomTextView"

if you are using the control in a number of places this runtime error
does nothing to help track down the problem.

Instead what we should be doing is detecting these issues and emitting
a build error. This will provide the user not only the problem but
also a link to the file causing the probem.

TODO
----

[ ] Fix up the name so it points to the file in `Resources` not `res`
[ ] Add a Unit test.
[ ] Add Error code and document.
dellis1972 added a commit to dellis1972/xamarin-android that referenced this issue Aug 1, 2018
…e fixed up.

Context dotnet#1711

When using a custom view within a layout file we replace the
`namespace.classname` with an `md5hash.classname`. We do this
by using the `acwmap.txt` file to make known types onto the
`md5` hashed ones. We do this in a case sensitive manner. We
also only support Camel case and lower case type names.

	ClassLibrary1.CustomView=md5d6f7135293df7527c983d45d07471c5e.CustomTextView
	classlibrary1.CustomView=md5d6f7135293df7527c983d45d07471c5e.CustomTextView

Given that a user is able to type these manually it is highly
probable that typo's will occur. If for example a user types

	Classlibrary1.CustomView

this will NOT be fixed up. Instead the user will recieve the
following error at runtime.

	FATAL UNHANDLED EXCEPTION: Android.Views.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class Classlibrary1.CustomTextView ---> Android.Views.InflateException: Binary XML file line #1: Error inflating class Classlibrary1.CustomTextView ---> Java.Lang.ClassNotFoundException: Didn't find class "Classlibrary1.CustomTextView"

if you are using the control in a number of places this runtime error
does nothing to help track down the problem.

Instead what we should be doing is detecting these issues and emitting
a build error. This will provide the user not only the problem but
also a link to the file causing the probem.

TODO
----

[ ] Fix up the name so it points to the file in `Resources` not `res`
[ ] Add a Unit test.
[ ] Add Error code and document.
dellis1972 added a commit to dellis1972/xamarin-android that referenced this issue Aug 2, 2018
…e fixed up.

Context dotnet#1711

When using a custom view within a layout file we replace the
`namespace.classname` with an `md5hash.classname`. We do this
by using the `acwmap.txt` file to make known types onto the
`md5` hashed ones. We do this in a case sensitive manner. We
also only support Camel case and lower case type names.

	ClassLibrary1.CustomView=md5d6f7135293df7527c983d45d07471c5e.CustomTextView
	classlibrary1.CustomView=md5d6f7135293df7527c983d45d07471c5e.CustomTextView

Given that a user is able to type these manually it is highly
probable that typo's will occur. If for example a user types

	Classlibrary1.CustomView

this will NOT be fixed up. Instead the user will recieve the
following error at runtime.

	FATAL UNHANDLED EXCEPTION: Android.Views.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class Classlibrary1.CustomTextView ---> Android.Views.InflateException: Binary XML file line #1: Error inflating class Classlibrary1.CustomTextView ---> Java.Lang.ClassNotFoundException: Didn't find class "Classlibrary1.CustomTextView"

if you are using the control in a number of places this runtime error
does nothing to help track down the problem.

Instead what we should be doing is detecting these issues and emitting
a build error. This will provide the user not only the problem but
also a link to the file causing the probem.

TODO
----

[ ] Fix up the name so it points to the file in `Resources` not `res`
[ ] Add a Unit test.
[ ] Add Error code and document.
jonpryor pushed a commit that referenced this issue Aug 2, 2018
…e fixed up. (#1720)

Context: #1711

When using a custom view within a layout file we replace the
`namespace.classname` with an `md5hash.classname`.  We do this by
using the `acwmap.txt` file to map known types onto the `md5` hashed
ones.  This is done in a case sensitive manner.  We also only support
identically-cased and lower-cased namespace/package names:

	ClassLibrary1.CustomView=md5d6f7135293df7527c983d45d07471c5e.CustomTextView
	classlibrary1.CustomView=md5d6f7135293df7527c983d45d07471c5e.CustomTextView

Given that a user is able to type these manually it is possible that
typo's will occur.  If for example a user types

	Classlibrary1.CustomView

this will NOT be fixed up, due to the lowercase `l` in `library`.
Instead the user will see the following error at runtime.

	FATAL UNHANDLED EXCEPTION: Android.Views.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class Classlibrary1.CustomTextView
	---> Android.Views.InflateException: Binary XML file line #1: Error inflating class Classlibrary1.CustomTextView
	---> Java.Lang.ClassNotFoundException: Didn't find class "Classlibrary1.CustomTextView"

If the control is used in a number of places this runtime error does
nothing to help track down the problem.

Improve this scenario by detecting these issues and emitting an
XA1002 build error.  This will not only inform the user about the
problem but also provide a link to the file causing the problem.
jonpryor pushed a commit that referenced this issue Aug 3, 2018
…e fixed up. (#1720)

Context: #1711

When using a custom view within a layout file we replace the
`namespace.classname` with an `md5hash.classname`.  We do this by
using the `acwmap.txt` file to map known types onto the `md5` hashed
ones.  This is done in a case sensitive manner.  We also only support
identically-cased and lower-cased namespace/package names:

	ClassLibrary1.CustomView=md5d6f7135293df7527c983d45d07471c5e.CustomTextView
	classlibrary1.CustomView=md5d6f7135293df7527c983d45d07471c5e.CustomTextView

Given that a user is able to type these manually it is possible that
typo's will occur.  If for example a user types

	Classlibrary1.CustomView

this will NOT be fixed up, due to the lowercase `l` in `library`.
Instead the user will see the following error at runtime.

	FATAL UNHANDLED EXCEPTION: Android.Views.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class Classlibrary1.CustomTextView
	---> Android.Views.InflateException: Binary XML file line #1: Error inflating class Classlibrary1.CustomTextView
	---> Java.Lang.ClassNotFoundException: Didn't find class "Classlibrary1.CustomTextView"

If the control is used in a number of places this runtime error does
nothing to help track down the problem.

Improve this scenario by detecting these issues and emitting an
XA1002 build error.  This will not only inform the user about the
problem but also provide a link to the file causing the problem.
@ghost ghost locked as resolved and limited conversation to collaborators Jun 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Area: App Runtime Issues in `libmonodroid.so`. vs-sync For internal use only; creates a VSTS "mirror" issue.
Projects
None yet
Development

No branches or pull requests

4 participants