question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Copying object with ImageSource type of properties throws exception

See original GitHub issue

Hi. I use this library for creating a snapshot of my view model in WPF app. Currently I have few properties that are of type ImageSource. They are bound to the view via INotifyPropertyChanged interface. I noticed that when creating deep copy of my view model, by grouping all the properties in dictionary <string, object>, where string is property name, and object is the value of the property,

I get the following inner exception: BitmapMetadata initialization incomplete. | System.Exception {System.InvalidOperationException

Stack trace of inner exception: at System.Windows.Media.Imaging.BitmapMetadata.EnsureBitmapMetadata() at System.Windows.Media.Imaging.BitmapMetadata.SetQuery(String query, Object value) at System.Windows.Media.Imaging.BitmapMetadata.set_Rating(Int32 value)

Complete stack trace:

at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture) at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, Object[] index) at System.Reflection.PropertyInfo.SetValue(Object obj, Object value) at FastDeepCloner.FastDeepClonerProperty.SetValue(Object o, Object value) at FastDeepCloner.ReferenceClone.ReferenceTypeClone(Dictionary2 properties, Type primaryType, Object objectToBeCloned, Object appendToValue) at FastDeepCloner.ReferenceClone.Clone(Object objectToBeCloned) at FastDeepCloner.ReferenceClone.ReferenceTypeClone(Dictionary2 properties, Type primaryType, Object objectToBeCloned, Object appendToValue) at FastDeepCloner.ReferenceClone.Clone(Object objectToBeCloned) at FastDeepCloner.ReferenceClone.Clone(Object objectToBeCloned) at FastDeepCloner.DeepCloner.Clone[T](T objectToBeCloned, FieldType fieldType)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
AlenTomacommented, May 8, 2020
0reactions
AlenTomacommented, May 22, 2020

You need to add NoneClonable to your ImageSource1, as i guss there will be the error

Read more comments on GitHub >

github_iconTop Results From Across the Web

ImageSourceConverter throws a NullReferenceException .. ...
ConvertFrom(coDrivr4.Properties.Resources.Music.GetHbitmap()) as ImageSource;. When I run my code, it says a NullReferenceException occurred.
Read more >
Image.Source Property (Windows.UI.Xaml.Controls)
This example throws an exception because it calls BaseUri on the Image before the Image is added to the page. It's assumed that...
Read more >
Object.assign() - JavaScript - MDN Web Docs
The Object.assign() static method copies all enumerable own properties from one or more source objects to a target object.
Read more >
BasicShapeAttributes (NASA World Wind)
Returns a new ShapeAttributes instance of the same type as this ShapeAttributes who's properties are configured exactly as this ShapeAttributes. void, copy( ...
Read more >
Xamarin imagesource fromfile. Alternatively, embedded ...
Choose an image from the Images collection: User45929 posted Hi, With Xamarin Froms on Android following exception is throwing when I set image...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found