Null Reference Exception when StreamResourceInfo attempts to get a ResourceStream?

Dileep 1

New member
Nov 18, 2012
8
0
0
Hi

I am getting Null Reference Exception when StreamResourceInfo attempts to get a ResourceStream in Windows phone 8 emulator. When i tried the same in Windows phone 7 emulator, the stream is getting correctly. But its not working on Windows phone 8 emulator. Please find the below code.

StreamResourceInfo streamInfo = App.GetResourceStream(new Uri("/Image;component/Images/123.png", UriKind.Relative));

Please help me out if any?
 
I'm not a WP developer (yet), but I am a .NET developer...
I always try to avoid referring to resources by their URI, as you never know exactly what it's going to be called, nor does it tell you in a debugger if the URI doesn't exist.
I don't know if this will work in WP, but in .NET I'd normally use:
Code:
System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("123.png")
to get the actual stream.

Hope you figure it out!
 
Is your png file set as Resource or Embedded Resource? Perhaps it's not being added to the build if one of these options isn't set.
 
Hi

I am getting Null Reference Exception when StreamResourceInfo attempts to get a ResourceStream in Windows phone 8 emulator. When i tried the same in Windows phone 7 emulator, the stream is getting correctly. But its not working on Windows phone 8 emulator. Please find the below code.

StreamResourceInfo streamInfo = App.GetResourceStream(new Uri("/Image;component/Images/123.png", UriKind.Relative));

Please help me out if any?

Have you set your png image as Resource on your properties? Have you got the Images folder in your root?

Regards.
 

Members online

No members online now.

Forum statistics

Threads
339,544
Messages
2,262,570
Members
428,763
Latest member
rewfvcsx err