Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ok1ok1 opened this issue Mar 28, 2024 · 12 comments
Assignees
Labels
external bug A bug caused by a external source

Comments

@ok1ok1
Copy link

ok1ok1 commented Mar 28, 2024

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

  • Printer: Epax X1-4K
  • Slicer: Lychee 5.4.3 & 6.0 (Beta)

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
Copy link
Owner

sn4k3 commented Mar 28, 2024

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

@ok1ok1
Copy link
Author

ok1ok1 commented Mar 29, 2024

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
Copy link
Owner

sn4k3 commented Mar 29, 2024

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
Copy link
Author

ok1ok1 commented Mar 29, 2024

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 sn4k3 added the external bug A bug caused by a external source label Mar 29, 2024
@sn4k3
Copy link
Owner

sn4k3 commented Mar 29, 2024

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.

@pattonwebz
Copy link

pattonwebz commented Sep 14, 2024

I am seeing this issue (well an error with a trace that is very very similar).

Happens when trying to convert a cxdlpv4 file format to any of the ctb type formats.

I am running the latest release. Linux appimage version.

Stack trace:

System.NullReferenceException: Object reference not set to an instance of an object.
   at UVtools.Core.FileFormats.CTBEncryptedFile.EncodeInternally(OperationProgress progress) in UVtools.Core/FileFormats/CTBEncryptedFile.cs:line 1379
   at UVtools.Core.FileFormats.FileFormat.Encode(String fileFullPath, OperationProgress progress) in UVtools.Core/FileFormats/FileFormat.cs:line 4484
   at UVtools.Core.FileFormats.FileFormat.Convert(Type to, String fileFullPath, UInt32 version, OperationProgress progress) in UVtools.Core/FileFormats/FileFormat.cs:line 6404
   at UVtools.Core.FileFormats.FileFormat.Convert(FileFormat to, String fileFullPath, UInt32 version, OperationProgress progress) in UVtools.Core/FileFormats/FileFormat.cs:line 6418
   at UVtools.UI.MainWindow.<>c__DisplayClass101_0.<ConvertToOnClick>b__0() in UVtools.UI/MainWindow.axaml.cs:line 2074

@sn4k3
Copy link
Owner

sn4k3 commented Sep 14, 2024

@pattonwebz Can provide the cxdlpv4 you trying to convert?

@pattonwebz
Copy link

pattonwebz commented Sep 14, 2024

Hey @sn4k3,

It's happening with all the sliced files I tried in the last few weeks (I hadn't tried to convert to ctb format till just 2 weeks back). Here's the simplest I tested:

cube.zip

I haven't tried converting other file formats to ctb since my slicer only produces cxdlpv4 for my printer. But I can test that tomorrow.

@sn4k3
Copy link
Owner

sn4k3 commented Sep 15, 2024

Found the problem within the convert, it only affect version 5 of the format.
To bypass the problem go to File - Terminal and send the command: SlicerFile.MaterialName = string.Empty; then you can convert.

@pattonwebz
Copy link

Amazing, thanks for looking at this so fast!

That is working after setting the empty string in terminal.

For me the issue is present when converting to both v4 and v5 ctb files. Running the command resolves the issue for both though.

Peek.2024-09-15.02-34.mp4

@sn4k3
Copy link
Owner

sn4k3 commented Sep 15, 2024

For me the issue is present when converting to both v4 and v5 ctb files.

After this statement I inspected the code and found that version selector have a bug causing your convertion to always use CTBv5 no matter what version you selected.

Will fix both on next release.

sn4k3 added a commit that referenced this issue Oct 4, 2024
- **File formats:**
  - (Change) Rename file and class from `PhotonSFile` to `AnycubicPhotonSFile`
  - (Change) Rename file and class from `PhotonWorkshopFile` to `AnycubicFile`
  - (Change) Rename file and class from `CXDLPFile` to `CrealityCXDLPFile`
  - (Change) Rename convert menu group from `CXDLP` to `Creality CXDLP`
  - (Fix) CTB (Version 5): `NullReferenceException` when trying to convert from a file with a `null` MaterialName (#857)
  - (Fix) Sanitize file version before convert the file to ensure capabilities (#934)
  - (Fix) Unable to set the format version when converting from files with a version that match it own default version (#857)
@sn4k3
Copy link
Owner

sn4k3 commented Oct 4, 2024

Closing as fixed

@sn4k3 sn4k3 closed this as completed Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external bug A bug caused by a external source
Projects
None yet
Development

No branches or pull requests

3 participants