sn4k3 / UVtools

MSLA/DLP, file analysis, calibration, repair, conversion and manipulation
GNU Affero General Public License v3.0
1.15k stars 103 forks source link

[Bug] Can't save files since last update. (MacOS) System.NullReferenceException: Object reference not set #857

Open ok1ok1 opened 4 months ago

ok1ok1 commented 4 months ago

System

UVtools v4.2.5 Arm64
Operative system: Darwin 23.4.0 Darwin Kernel Version 23.4.0: Fri Mar 15 00:19:22 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T8112 Arm64
Processor: Apple M2
Processor cores: 8
Memory RAM: 7.03 / 12.73 GB
Runtime: osx.14-arm64
Framework: .NET 6.0.27
AvaloniaUI: 11.0.10
OpenCV: 4.8.1

Sreens, resolution, working area, usable area:
1: 1920 x 1080 @ 100% (Primary)
    WA: 1920 x 978    UA: 1920 x 978
2: 1920 x 1080 @ 100%
    WA: 1920 x 1055    UA: 1920 x 1055

Path:       /Applications/UVtools.app/Contents/MacOS/
Executable: /Applications/UVtools.app/Contents/MacOS/UVtools
Loaded file: test.ctb [Version: 4] [Class: ChituboxFile]

Printer and Slicer

Description of the bug

The app functions normally until it comes time to save. When a save is attempted the app returns the following error. "Error while saving the file" System.NullReferenceException: Object reference not set to an instance of an object. at UVtools.Core.FileFormats.ChituboxFile.EncodeInternally(OperationProgress progress) in UVtools.Core/FileFormats/ChituboxFile.cs:line 1908 at UVtools.Core.FileFormats.FileFormat.Encode(String fileFullPath, OperationProgress progress) in UVtools.Core/FileFormats/FileFormat.cs:line 4102 at UVtools.Core.FileFormats.FileFormat.SaveAs(String filePath, OperationProgress progress) in UVtools.Core/FileFormats/FileFormat.cs:line 5558 at UVtools.UI.MainWindow.<>c__DisplayClass102_0.b__0() in UVtools.UI/MainWindow.axaml.cs:line 2078

Screenshot 2024-03-27 at 10 15 01 PM

How to reproduce

  1. Open a .ctb file.
  2. Attempt to save the file.

I've reinstalled my slicer and UVtools. No change in behavior. This error only seems to be present on the MacOS version.

Files

Example file can be downloaded here: https://memoryvault.myds.me:5001/d/s/xmBg1iKmrCa3Bf8L5JPA9OO5EzdrTlub/Jg4MRW1nzMslPptg2yiffN-NRELDIUv4-rLuAppDbPQs

sn4k3 commented 4 months ago

The error line does not make sense to trigger the problem. Can you try downgrade 1 version and try again?

ok1ok1 commented 4 months ago

I can try that. I normally use the auto install command with terminal to upgrade. How do I install an older image?

Also, I did a little more testing. If I do a quick open and save of the .ctb file using the windows version of UV Tools 4.2.5 I can then open the file, do my edits, and save using the Mac version. Basically there is something about the files generated by Lychee that the mac version doesn't like.

sn4k3 commented 4 months ago

I can try that. I normally use the auto install command with terminal to upgrade. How do I install an older image?

Try with: bash -c "$(curl -fsSL https://raw.githubusercontent.com/sn4k3/UVtools/master/Scripts/install-uvtools.sh)" -- 4.2.4

Basically there is something about the files generated by Lychee that the mac version doesn't like.

There are no different conditions for OS-specific under UVtools core code. Which make me thing error come from UI framework. The error line from dump does not make sense, it can not be null...

ok1ok1 commented 4 months ago

It looks like you're likely on the right track. I reverted to version 4.2.4. Everything functioned normally. Just to be sure I ran the 4.2.5 update again & the problem returned.

sn4k3 commented 4 months ago

As the stack trace is no useful and present the wrong cause, I have no way to debug this (No mac machine to run under debugger). Let's hope next release of the UI framework fix this issue.