Get ready for beta!

Halo Wars 2 Blitz: Game modes, beginner's tips, and more

One Windows

Microsoft is building a new Windows 10 Shell for PC, Mobile and Xbox

On the Inside

Everything you need to know about the Xbox Insider Program

Beautiful compromises

Surface Studio review: you'll want one, even if you don't need one

3-in-1

Is this the Surface Phone? Microsoft awarded patents for foldable devices

Windows Central Offers

MCSE Certification bundle is just $39

Even more improvements

All the changes found in Windows 10 build 15007!

Games as a Service

What does the cancellation of Scalebound mean for future Xbox exclusives?

Windows Central Offers

Save $90 on these FRESHeBUDS Pro Magnetic Bluetooth Earbuds

Returning for 2017

We're back with an new episode of #AskDanWindows

Lifetime Subscription

VPNSecure is currently 91% off

Our favorite things

The Best of CES 2017 Awards

Infinity Edge in your hand

The XPS 13 2-in-1 is the Dell convertible we've always wanted

Project Valerie

Razer just made a laptop with three — THREE! — 17-inch 4K displays. 😱

Great design from Palo Alto

HP's CES 2017 releases are truly gorgeous PCs

Intel and Google's big day

CES 2017 Day Two: New laptops, new phones, and old ideas made new

Take five is better than ever

The updated Lenovo ThinkPad X1 packs Kaby Lake chips and zero bloatware

Everything we know about the next Xbox: Project Scorpio

UWPowered

'Game Mode' for Windows 10 will power Xbox One and Scorpio games too

Buyer's guide

Best accessories for Microsoft Surface Book

< >
Welcome to the Windows Central Forums Create Your Account or Ask a Question Answers in 5 minutes - no registration required!
Results 1 to 6 of 6
  1. Dileep 1's Avatar
    Member

    Posts
    8 Posts
       #1  
    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?
  2. elyl's Avatar
    Member

    Posts
    25 Posts
    Global Posts
    31 Global Posts
    #2  
    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")[/CODE]
    to get the actual stream.

    Hope you figure it out!
  3. Dileep 1's Avatar
    Member

    Posts
    8 Posts
       #3  
    Than Q for the reply. I tried using the above approach and getting the same issue.
  4. elyl's Avatar
    Member

    Posts
    25 Posts
    Global Posts
    31 Global Posts
    #4  
    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.
  5. #5  
    Quote Originally Posted by Dileep 1 View Post
    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.
  6. jumanakassim's Avatar
    Member

    Posts
    1 Posts
    #6  
    Remove the '/' before the image url

Similar Threads

  1. When do you expect to get your Nokia?
    By jwckauman in forum Nokia Lumia 920
    Replies: 13
    Last Post: 11-09-2012, 12:59 PM
  2. Replies: 8
    Last Post: 08-31-2011, 07:35 AM
  3. Replies: 1
    Last Post: 07-27-2011, 08:29 AM
  4. Busy Signal when attempting to call
    By jesdt in forum Samsung Omnia 7
    Replies: 0
    Last Post: 07-19-2011, 07:00 PM

Posting Permissions