Invalid filename. TitleContainer.OpenStream requires a relative URI

.net, c#, wpf, xna

Solution

i'm partially guessing here, but try

pic_texture = Texture2D.FromStream(GraphicsDevice, TitleContainer.OpenStream(@"Images\performer.png"));

without the first `\`

Debugging

In your program, add these lines immidiately before the line where your error happens.

FileStream fs = new FileStream("myUniqueFile.txt", FileMode.Create);
fs.Close();

make sure you have

using System.IO

at the top of the code file.

Once you've done that, Search your computer for `"myUniqueFile.txt"` and tell me in the comments where you've found it.

Problem

I have got this error in WPF application. Invalid filename. TitleContainer.OpenStream requires a relative URI. ``` pic_texture = Texture2D.FromStream(GraphicsDevice, TitleContainer.OpenStream(@"\Images\performer.png")); ``` I have tried also ``` @"/WpfControlLibrary1;component/Images/performer.png" ``` No success... if I do like this ``` pic_texture = Texture2D.FromStream(GraphicsDevice, TitleContainer.OpenStream(@"performer.png")); ``` and put file in the root The error is: Error loading "performer.png". File not found. Any clue? Thank you! P.S. I am sure file is OK. UPDATE: This post https://gamedev.stackexchange.com/questions/9748/xna-am-i-screwing-up-the-loadcontent-for-texture2d doesn't help also.

Original source