Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9222629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:52:39+00:00 2026-06-18T03:52:39+00:00

When I add the type BitmapImage to my class for my Windows 8 application

  • 0

When I add the type BitmapImage to my class for my Windows 8 application (below), I get the:

Cannot serialize member vehicleImage' of type 'Windows.UI.Xaml.Media.Imaging.BitmapImage', see inner exception for more details.

Inner Exception Details:

 System.Runtime.InteropServices.WindowsRuntime.RuntimeClass is inaccessible due to its protection level. Only public types can be processed.

Code:

public BitmapImage vehicleImage

        {
            get
            {
                return m_vehicleImage;
            }
            set
            {
                Uri _baseUri = new Uri("ms-appx:///");
                BitmapImage imageBitmap = new BitmapImage(new Uri(_baseUri, ImagePath));
                m_vehicleImage = imageBitmap;
                OnPropertyChanged("vehicleImage");
            }
        }

        private async void SetImage()
        {
            var file = await Windows.Storage.KnownFolders.PicturesLibrary.GetFileAsync(ImagePath);
            var fileStream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read);
            var img = new BitmapImage();
            img.SetSource(fileStream);

            vehicleImage = img;
        }

I’m serializing the object into XML. When I remove this bit of code everything works. I’d like to have the ability to have an image that the user selects from their computer (which is why I’m trying to use the BitmapImage type).

Any help is appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T03:52:40+00:00Added an answer on June 18, 2026 at 3:52 am

    Use the System.Xml.Serialization namespace to access [XMLIgnore()] for these sort of properties.

    You should want to store the string of where the image is, correct? Then you serialize the string, and [XMLIgnore()] the BitMapImage.

    This allows the BitMap Image to still be accessed while serialization can occur.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

why can I not add a wpfImage of type BitmapImage/BitmapSource/ImageSource to a Resource file.
add-type -Language CSharpVersion3 -TypeDefinition @ public class pack_code { public pack_code() {} public string
I just learned to include C# code into Powershell and use Add-Type to get
i tryed to build WPF application using Add-Type, but it failed. $a = @'
I have a class that I define in inline C# in powershell: Add-Type -TypeDefinition
I've made a c# class that I'm trying to run in PowerShell with add-Type.
Code: add-type @ public interface IFoo { void Foo(); } public class Bar :
The following code gives me the error (cannot add type Object to Stackpanel). How
I have the following Powershell code: Add-Type -Assembly System.Configuration [ExeConfigurationFileMap] $configMap = New-Object ExeConfigurationFileMap
I wish to add some type of business logic constraint to a table, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.