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
    14 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")
    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
    14 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, 11:59 AM
  2. Replies: 8
    Last Post: 08-31-2011, 06:35 AM
  3. Replies: 1
    Last Post: 07-27-2011, 07:29 AM
  4. Busy Signal when attempting to call
    By jesdt in forum Samsung Omnia 7
    Replies: 0
    Last Post: 07-19-2011, 06:00 PM

Posting Permissions

B