Bug 9861 - Wrong filename provided for Android Resources containing errors
Summary: Wrong filename provided for Android Resources containing errors
Status: RESOLVED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild ()
Version: 4.5.x
Hardware: PC Mac OS
: Normal enhancement
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-01-29 16:27 UTC by Jonathan Pryor
Modified: 2017-07-06 15:58 UTC (History)
5 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 Jonathan Pryor 2013-01-29 16:27:17 UTC
Context: http://forums.xamarin.com/discussion/978/build-error-points-to-main-xml-instead-of-main-axml#latest

When an error is found within an Android Resources, the wrong filename is used in the error message.

To reproduce:

1. Create a default template project.
2. Edit the Resources\Layout\Main.axml file, AS SOURCE (not the GUI editor)
3. Change the //Button/@android:text attribute to refer to an invalid string resource name, e.g.

    <Button  
        android:id="@+id/myButton"
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:text="@string/hello__"
    />

4. Build

Expected result:

The error message should state that the error is in Resources\Layout\Main.axml.

Actual result:

    /Library/Frameworks/Mono.framework/External/xbuild/Novell/Novell.MonoDroid.Common.targets:
    Error: Tool exited with code: 1. Output: obj/Debug/res/layout/main.xml:1: error:
    Error: No resource found that matches the given name (at 'text' with value '@string/hello__').

Note two things:

1. The path is wrong
2. The error output isn't in a "parseable" form. Consequently when double-clicking on the error the .targets file will be opened, instead of the relevant file.
Comment 2 Prashant [MSFT] 2017-07-04 07:19:17 UTC
I don't see this issue in the latest 15.2 release.
The error reported as expected
Comment 3 Prashant [MSFT] 2017-07-06 15:58:27 UTC
In the latest version of Xamarin.Android tools the file name in the error message reported as expected

ex: 
Resources/layout/Main.axml(2): error APT0000:  Error: No resource found that matches the given name (at 'text' with value '@string/hello__').

Full build log - 
https://gist.github.com/prashantvc/1273798d73f071f3301151ab2b3addec#file-gistfile1-txt-L117