Bug 24454 - Embedded resource name is missing subdirectories
Summary: Embedded resource name is missing subdirectories
Alias: None
Product: Tools
Classification: Mono
Component: xbuild ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2014-11-11 20:43 UTC by Adam Reeve
Modified: 2018-03-15 10:40 UTC (History)
4 users (show)

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 GitHub or Developer Community 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:

Description Adam Reeve 2014-11-11 20:43:01 UTC
I ran into this issue when trying to use MonoGame on Linux. I'm using Monodevelop 5.4 and tested this with Mono from the current master branch in git (c09cd684b45de5345e72a7f341b3de7156c89cc2). See https://github.com/mono/MonoGame/issues/3160 for the bug report in MonoGame. There's also a description of this bug at https://plus.google.com/+flibitijibibo/posts/KzeuHnQt96E.

MonoGame builds and runs correctly with Mono 2.10.

It appears that the name of an embedded resource is being set to the root namespace of the project plus the name of the file, without including any subdirectories.

For example, the resource named "Microsoft.Xna.Framework.Graphics.Effect.Resources.SpriteEffect.ogl.mgfxo" is part of a project with a root namespace of "Microsoft.Xna.Framework", and is located at "Graphics/Effect/Resources/SpriteEffect.ogl.mgfxo". But the assembly has the name set to "Microsoft.Xna.Framework.SpriteEffect.ogl.mgfxo".

Strangely, this issue isn't produced consistently. Some builds work fine, but other times the builds have this error. I've tried to construct a minimal example that demonstrates this behaviour and failed. For my minimal example, the embedded resource name was always correct and included the subdirectories. So it appears that there's something extra in MonoGame that triggers this issue.
Comment 1 Lorenzo Delana 2017-01-17 01:50:45 UTC
I seen similar behavior for the DotSpatial project at https://github.com/DotSpatial/DotSpatial/blob/master/Source/DotSpatial.Projections/DeflateStreamReader.cs

what happens is a null pointer cause it searches the resource name "DotSpatial.Projections.AuthorityCodes.AuthorityCodeToProj4.ds" but from available resource names I got

watching at the project folder structure (https://github.com/DotSpatial/DotSpatial/tree/2871417c8e42b4b9d8eaa43b4df8834761c31ee6/Source/DotSpatial.Projections/AuthorityCodes) seems that the resource file

DotSpatial/Source/DotSpatial.Projections/AuthorityCodes/AuthorityCodeToProj4.ds was embedded w/out considering the "AuthorityCodes" subfolder in the fullname of the resource itself.
Comment 2 Marek Safar 2018-03-15 10:40:07 UTC
We deprecated xbuild and recommend using msbuild instead. Switching to msbuild will also most likely resolve the issue you reported.