Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

GetManifestResourceStream stopped working in Xamarin Studio 5.9.0?

$
0
0

I just took the latest downloads:

  • Mono Framework MDK 4.0.0.143
  • Xamarin Studio 5.9.0
  • Xamarin.Android 5.1.0.115
  • Xamaring.iOS 8.10.0.267

I have this code, which was working previously:
private void LoadGemsFromFile(string resource)
{
index = -1;
Assembly assembly = this.GetType ().GetTypeInfo ().Assembly;

                    // TODO:  Need to read in a device agnostic fashion
                // http://developer.xamarin.com/guides/cross-platform/xamarin-forms/working-with/files/
                using (Stream stream = assembly.GetManifestResourceStream(resource)) {
                    using (StreamReader reader = new StreamReader (stream)) {
                        string line;
                        while ((line = reader.ReadLine ()) != null) {
                            index++;
                            string[] items = line.Split (DELIMITER, 2, StringSplitOptions.None);
                            if (items.Length > 0) {
                                GemRecord record = new GemRecord ();
                                record.Message = items [0].Trim (TRIM_CHARS);
                                if (items.Length > 1) {
                                    record.Author = items [1].Trim (TRIM_CHARS);
                                }
                                record.GemIndex = index;
                                theList.Add (record);
                            }
                        }
                    }
                }
            }

where resource = "HelloForms.GemPack1.txt"

This used to work but now assembly.GetManifestResourceStream returns null.

"HelloForms" is a PCL which references GemsModel, which is a shared project.

In GemsModel, the structure is:
GemsModel
GemPacks
GemPack1.txt

I double checked that Build Action is still EmbeddedResource for GemPack1.txt.

Can anyone tell me what is going wrong and how to fix it?


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>