Bug 26360 - EmbeddedResource not found at runtime
Summary: EmbeddedResource not found at runtime
Alias: None
Product: iOS
Classification: Xamarin
Component: MSBuild ()
Version: XI 8.6.0
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2015-01-23 15:58 UTC by Joe Cooper
Modified: 2016-05-26 21:22 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 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:

Description Joe Cooper 2015-01-23 15:58:40 UTC
I have the following code:

const string ContentModelResourceName = "[redacted].Core.Resources.ContentModel.json";
var assembly = typeof(GameService).GetTypeInfo().Assembly;
using (var contentModelStream = assembly.GetManifestResourceStream (ContentModelResourceName)) {
    contentModel = (ContentModel) ser.ReadObject (contentModelStream);

It worked earlier today just fine and has been for about a week.

But when I ran a build just now, it started throwing an ArgumentException because GetManifestResourceStream now returns null.

So far as I can tell, nothing at all relevant changed. I did amend some code in a different project, (the iOS one), relating to SceneKit, between now and the last time I saw it work correctly.

I've fiddled with it for an hour and I can't find any reason or anything that has changed.

I did try restarting Xamarin.
Comment 1 Joe Cooper 2015-01-24 05:36:10 UTC
If I change the resource ID in the Xamarin Studio properties editor, and in the code, to just "ContentModel.json", than now it works.

The longer form worked yesterday and every day, for two weeks, leading up to yesterday, and on every app I've ever developed.

But as of yesterday it no longer works on this one and needs to have the rest of it cropped off.

I did try a git stash and revert and clearing cashes and clean all and everything I could think of. I'm dumbfounded. This is the third time this week that Xamarin's behavior suddenly changed without an update of any kind. I feel like y'all discovered some way to get computers to behave nondeterministically.
Comment 2 Rolf Bjarne Kvinge [MSFT] 2015-01-26 07:57:56 UTC
There are a few things you can do in a csproj that will make us switch to a new build system (MSBuild based), in particular the first time you use new iOS features (one example would be assets catalogs).

This could be what happened, but it would change the csproj (so it's a revertable change if you're using git), and you can easily see it in a diff. Could you check if your csproj has changed?
Comment 3 Sebastien Pouliot 2016-05-26 21:22:09 UTC
We have not received the requested information. If you are still experiencing this issue please provide all the requested information and re-open the bug report. Thanks!