[GH-ISSUE #639] Removes all user settings #522

Closed
opened 2026-02-26 09:31:45 +03:00 by kerem · 4 comments
Owner

Originally created by @lukaszmn on GitHub (Apr 20, 2020).
Original GitHub issue: https://github.com/NickeManarin/ScreenToGif/issues/639

When I started it today, it removed all my settings. After I set a few options:

  • language: English
  • one saving preset for mp4
  • location for ffmpeg

it doesn't save any options, and prints the following error to the log file:

► Title - 
	Saving settings
▬ Message - 
	Object reference not set to an instance of an object.
○ Type - 
	System.NullReferenceException
♦ [Version] Date/Hour - 
	[2.23.1] 04/20/2020 05:07:11
▲ Source - 
	mscorlib
▼ TargetSite - 
	System.Type GetType()
♠ StackTrace - 
   at System.Object.GetType()
   at System.Windows.Markup.Primitives.ElementMarkupObject.get_ObjectType()
   at System.Windows.Markup.Primitives.MarkupWriter.RecordNamespaces(Scope scope, MarkupObject item, IValueSerializerContext context, Boolean lastWasString)
   at System.Windows.Markup.Primitives.MarkupWriter.RecordNamespaces(Scope scope, MarkupObject item, IValueSerializerContext context, Boolean lastWasString)
   at System.Windows.Markup.Primitives.MarkupWriter.WriteItem(MarkupObject item)
   at System.Windows.Markup.Primitives.MarkupWriter.SaveAsXml(XmlWriter writer, MarkupObject item)
   at System.Windows.Markup.XamlWriter.Save(Object obj, XmlWriter xmlWriter)
   at ScreenToGif.Util.UserSettings.Save()

What's worse, it also deletes the backup file.

Originally created by @lukaszmn on GitHub (Apr 20, 2020). Original GitHub issue: https://github.com/NickeManarin/ScreenToGif/issues/639 When I started it today, it removed all my settings. After I set a few options: * language: English * one saving preset for mp4 * location for ffmpeg it doesn't save any options, and prints the following error to the log file: ``` ► Title - Saving settings ▬ Message - Object reference not set to an instance of an object. ○ Type - System.NullReferenceException ♦ [Version] Date/Hour - [2.23.1] 04/20/2020 05:07:11 ▲ Source - mscorlib ▼ TargetSite - System.Type GetType() ♠ StackTrace - at System.Object.GetType() at System.Windows.Markup.Primitives.ElementMarkupObject.get_ObjectType() at System.Windows.Markup.Primitives.MarkupWriter.RecordNamespaces(Scope scope, MarkupObject item, IValueSerializerContext context, Boolean lastWasString) at System.Windows.Markup.Primitives.MarkupWriter.RecordNamespaces(Scope scope, MarkupObject item, IValueSerializerContext context, Boolean lastWasString) at System.Windows.Markup.Primitives.MarkupWriter.WriteItem(MarkupObject item) at System.Windows.Markup.Primitives.MarkupWriter.SaveAsXml(XmlWriter writer, MarkupObject item) at System.Windows.Markup.XamlWriter.Save(Object obj, XmlWriter xmlWriter) at ScreenToGif.Util.UserSettings.Save() ``` What's worse, it also deletes the backup file.
kerem closed this issue 2026-02-26 09:31:45 +03:00
Author
Owner

@bNobo commented on GitHub (Apr 26, 2020):

I was not able to reproduce this issue. Could you provide steps to reproduce the error ?

<!-- gh-comment-id:619457774 --> @bNobo commented on GitHub (Apr 26, 2020): I was not able to reproduce this issue. Could you provide steps to reproduce the error ?
Author
Owner

@lukaszmn commented on GitHub (Apr 26, 2020):

Assumptions:

  1. ffmpeg is downloaded and set in the ScreenToGif config

Steps:

  1. Record a short movie
  2. Click Save As
  3. Select Video > FFmpeg
  4. Select a file with .mp4 extension
  5. Add a new Preset
    • name: abc
    • value: -pix_fmt yuv420p -force_key_frames expr:gte(t,n_forced/2) -c:v libx264 -crf 18 -bf 2 -use_editlist 0 -movflags +faststart -vf "scale=-2:720:flags=lanczos"
  6. Save the Preset
  7. Close the application

Result:

C:\Users\...\AppData\Roaming\ScreenToGif\Settings.xaml has size of 3 bytes.

<!-- gh-comment-id:619532041 --> @lukaszmn commented on GitHub (Apr 26, 2020): Assumptions: 1. ffmpeg is downloaded and set in the ScreenToGif config Steps: 1. Record a short movie 2. Click Save As 3. Select Video > FFmpeg 3. Select a file with `.mp4` extension 4. Add a new Preset * name: `abc` * value: `-pix_fmt yuv420p -force_key_frames expr:gte(t,n_forced/2) -c:v libx264 -crf 18 -bf 2 -use_editlist 0 -movflags +faststart -vf "scale=-2:720:flags=lanczos"` 5. Save the Preset 6. Close the application Result: `C:\Users\...\AppData\Roaming\ScreenToGif\Settings.xaml` has size of 3 bytes.
Author
Owner

@bNobo commented on GitHub (Apr 27, 2020):

Thank you @lukaszm, I was able to reproduce the exception with your detailed explanation. It seems the problem comes when selecting the .mp4 extension. I've proposed a pull request to solve it.

<!-- gh-comment-id:619645419 --> @bNobo commented on GitHub (Apr 27, 2020): Thank you @lukaszm, I was able to reproduce the exception with your detailed explanation. It seems the problem comes when selecting the .mp4 extension. I've proposed a pull request to solve it.
Author
Owner

@NickeManarin commented on GitHub (Apr 29, 2020):

Thank you @bNobo and @lukaszmn !

<!-- gh-comment-id:621189978 --> @NickeManarin commented on GitHub (Apr 29, 2020): Thank you @bNobo and @lukaszmn !
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ScreenToGif#522
No description provided.