[Bug] System.NullReferenceException: Object reference not set to an instance of an object (Lychee 7.2 ctb v4)
System
UVtools v5.0.7 X64
Operative system: Darwin 21.6.0 Darwin Kernel Version 21.6.0: Thu Jul 6 22:18:26 PDT 2023; root:xnu-8020.240.18.702.13~1/RELEASE_X86_64 X64
Processor: Intel(R) Xeon(R) CPU X5680 @ 3.33GHz
Processor cores: 24
Memory RAM: 23.02 / 43.12 GB
Runtime: osx-x64
Framework: .NET 9.0.2
AvaloniaUI: 11.2.4
OpenCV: 4.10.0
Sreens, resolution, working area, usable area:
1: 3840 x 2160 @ 100% (Primary) (On this)
WA: 3840 x 2135 UA: 3840 x 2135
Path: /Applications/UVtools.app/Contents/MacOS/
Executable: /Applications/UVtools.app/Contents/MacOS/UVtools
Loaded file: elephant8_07m_10ml_copy.ctb [Version: 4] [Class: ChituboxFile]
General configuration for OpenCV 4.10.0 =====================================
Version control: 3.4.2-10289-g3beff6e6c5
Platform:
Timestamp: 2025-01-17T23:11:46Z
Host: Darwin 21.6.0 x86_64
CMake: 3.31.4
CMake generator: Unix Makefiles
CMake build tool: /usr/bin/make
Configuration: Release
CPU/HW features:
Baseline: SSE SSE2 SSE3 SSSE3 SSE4_1
requested: DETECT
Dispatched code generation: SSE4_2 FP16 AVX AVX2 AVX512_SKX
requested: SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
SSE4_2 (1 files): + POPCNT SSE4_2
FP16 (0 files): + POPCNT SSE4_2 FP16 AVX
AVX (3 files): + POPCNT SSE4_2 AVX
AVX2 (25 files): + POPCNT SSE4_2 FP16 FMA3 AVX AVX2
AVX512_SKX (2 files): + POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX
C/C++:
Built as dynamic libs?: NO
C++ standard: 11
C++ Compiler: /Library/Developer/CommandLineTools/usr/bin/c++ (ver 14.0.0.14000029)
C++ flags (Release): -fsigned-char -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -Wno-deprecated-copy -O3 -DNDEBUG -DNDEBUG
C++ flags (Debug): -fsigned-char -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -Wno-deprecated-copy -g -O0 -DDEBUG -D_DEBUG
C Compiler: /Library/Developer/CommandLineTools/usr/bin/cc
C flags (Release): -fsigned-char -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG
C flags (Debug): -fsigned-char -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
Linker flags (Release): -Wl,-dead_strip
Linker flags (Debug): -Wl,-dead_strip
ccache: NO
Precompiled headers: NO
Extra dependencies: -framework OpenCL -framework Cocoa -framework AppKit
3rdparty dependencies: ittnotify libjpeg-turbo libpng libtiff libopenjp2 IlmImf zlib
OpenCV modules:
To be built: core highgui imgcodecs imgproc videoio
Disabled: dnn features2d flann gapi ml photo video world
Disabled by dependency: calib3d objdetect stitching
Unavailable: java python2 python3 ts
Applications: -
Documentation: NO
Non-free algorithms: NO
GUI: COCOA
Cocoa: YES
VTK support: NO
Media I/O:
ZLib: build (ver 1.3.1)
JPEG: build-libjpeg-turbo (ver 3.0.3-70)
SIMD Support Request: YES
SIMD Support: NO
PNG: build (ver 1.6.43)
SIMD Support Request: YES
SIMD Support: YES (Intel SSE)
TIFF: build (ver 42 - 4.6.0)
JPEG 2000: build (ver 2.5.0)
OpenEXR: build (ver 2.3.0)
HDR: YES
SUNRASTER: YES
PXM: YES
PFM: YES
Video I/O:
DC1394: NO
FFMPEG: NO
avcodec: NO
avformat: NO
avutil: NO
swscale: NO
avresample: NO
GStreamer: NO
AVFoundation: YES
Parallel framework: GCD
Trace: YES (with Intel ITT)
Other third-party libraries:
Eigen: YES (ver 3.4.0)
Custom HAL: NO
Protobuf: build (3.19.1)
Flatbuffers: builtin/3rdparty (23.5.9)
OpenCL: YES (no extra features)
Include path: NO
Link libraries: -framework OpenCL
Python (for build): /usr/local/bin/python3
Java:
ant: NO
Java: NO
JNI: NO
Java wrappers: NO
Java tests: NO
Install to: /Users/tiago/Downloads/emgucv/platforms/macos/build_x86_64/install
-----------------------------------------------------------------
Loaded Assemblies:
001: System.Private.CoreLib, Version=9.0.0.0
002: UVtools, Version=5.0.7.0
003: System.Runtime, Version=9.0.0.0
004: UVtools.Core, Version=5.0.7.0
005: System.Linq, Version=9.0.0.0
006: System.ObjectModel, Version=9.0.0.0
007: System.Drawing.Primitives, Version=9.0.0.0
008: System.Collections, Version=9.0.0.0
009: Avalonia.Controls, Version=11.2.4.0
010: Avalonia.Base, Version=11.2.4.0
011: Avalonia.Native, Version=11.2.4.0
012: MicroCom.Runtime, Version=0.11.0.0
013: System.Collections.Concurrent, Version=9.0.0.0
014: System.Runtime.InteropServices, Version=9.0.0.0
015: Avalonia.Skia, Version=11.2.4.0
016: Avalonia.Win32, Version=11.2.4.0
017: System.Numerics.Vectors, Version=9.0.0.0
018: Avalonia.X11, Version=11.2.4.0
019: Projektanker.Icons.Avalonia, Version=9.6.0.0
020: netstandard, Version=2.1.0.0
021: Projektanker.Icons.Avalonia.FontAwesome, Version=9.6.0.0
022: Projektanker.Icons.Avalonia.MaterialDesign, Version=9.6.0.0
023: Avalonia.Desktop, Version=11.2.4.0
024: Avalonia.Fonts.Inter, Version=11.2.4.0
025: Avalonia.OpenGL, Version=11.2.4.0
026: System.ComponentModel.Primitives, Version=9.0.0.0
027: System.Threading, Version=9.0.0.0
028: System.Private.Uri, Version=9.0.0.0
029: SkiaSharp, Version=2.88.0.0
030: Avalonia.MicroCom, Version=11.2.4.0
031: Avalonia.Metal, Version=11.2.4.0
032: System.Threading.Thread, Version=9.0.0.0
033: Avalonia.Markup.Xaml, Version=11.2.4.0
034: System.ComponentModel, Version=9.0.0.0
035: Avalonia.Markup, Version=11.2.4.0
036: System.ComponentModel.TypeConverter, Version=9.0.0.0
037: System.Memory, Version=9.0.0.0
038: UVtools.AvaloniaControls, Version=4.0.4.0
039: Avalonia.Themes.Fluent, Version=11.2.4.0
040: Avalonia.Dialogs, Version=11.2.4.0
041: Avalonia.Controls.ColorPicker, Version=11.2.4.0
042: Avalonia.Controls.DataGrid, Version=11.2.4.0
043: System.Xml.XmlSerializer, Version=9.0.0.0
044: System.Private.Xml, Version=9.0.0.0
045: System.Collections.NonGeneric, Version=9.0.0.0
046: System.Text.Encoding.Extensions, Version=9.0.0.0
047: System.Runtime.Loader, Version=9.0.0.0
048: System.Diagnostics.TraceSource, Version=9.0.0.0
049: System.Collections.Specialized, Version=9.0.0.0
050: System.Xml.ReaderWriter, Version=9.0.0.0
051: System.Reflection.Emit.ILGeneration, Version=9.0.0.0
052: System.Reflection.Emit, Version=9.0.0.0
053: Microsoft.GeneratedCode, Version=1.0.0.0
054: System.Reflection.Primitives, Version=9.0.0.0
055: System.Text.RegularExpressions, Version=9.0.0.0
056: HarfBuzzSharp, Version=1.0.0.0
057: Emgu.CV, Version=4.10.0.5680
058: Microsoft.GeneratedCode, Version=1.0.0.0
059: Microsoft.GeneratedCode, Version=1.0.0.0
060: System.Text.Json, Version=9.0.0.0
061: System.Text.Encodings.Web, Version=9.0.0.0
062: System.Runtime.Intrinsics, Version=9.0.0.0
063: System.ComponentModel.Annotations, Version=9.0.0.0
064: System.Net.Http, Version=9.0.0.0
065: System.Net.Primitives, Version=9.0.0.0
066: BinarySerializer, Version=8.6.4.1
067: System.Diagnostics.Tracing, Version=9.0.0.0
068: System.Threading.Tasks, Version=9.0.0.0
069: System.Diagnostics.DiagnosticSource, Version=9.0.0.0
070: System.IO, Version=9.0.0.0
071: System.Text.Encoding, Version=9.0.0.0
072: System.Reflection.TypeExtensions, Version=9.0.0.0
073: System.Net.Security, Version=9.0.0.0
074: System.Reflection, Version=9.0.0.0
075: System.Security.Cryptography, Version=9.0.0.0
076: System.Reflection.Extensions, Version=9.0.0.0
077: System.Runtime.InteropServices.RuntimeInformation, Version=9.0.0.0
078: System.Linq.Expressions, Version=9.0.0.0
079: System.Net.Sockets, Version=9.0.0.0
080: Microsoft.Win32.Primitives, Version=9.0.0.0
081: System.Threading.ThreadPool, Version=9.0.0.0
082: System.Net.NameResolution, Version=9.0.0.0
083: System.Reflection.Emit.Lightweight, Version=9.0.0.0
084: Anonymously Hosted DynamicMethods Assembly, Version=0.0.0.0
085: System.Runtime.Extensions, Version=9.0.0.0
086: System.Threading.Tasks.Parallel, Version=9.0.0.0
087: K4os.Compression.LZ4, Version=1.3.8.0
088: System.Runtime.CompilerServices.Unsafe, Version=9.0.0.0
089: System.Formats.Asn1, Version=9.0.0.0
090: System.Runtime.Numerics, Version=9.0.0.0
091: CommunityToolkit.HighPerformance, Version=8.4.0.0
092: System.Diagnostics.StackTrace, Version=9.0.0.0
093: System.Reflection.Metadata, Version=9.0.0.0
094: System.Collections.Immutable, Version=9.0.0.0
095: System.IO.MemoryMappedFiles, Version=9.0.0.0
096: Markdown.Avalonia, Version=11.0.2.0
097: CommunityToolkit.Diagnostics, Version=8.4.0.0
098: System.IO.FileSystem.DriveInfo, Version=9.0.0.0
099: System.Diagnostics.Process, Version=9.0.0.0
100: System.IO.Pipes, Version=9.0.0.0
Printer and Slicer
- Printer: Elegoo Mars 2
- Slicer: Lychee 7.2
Description of the bug
When I slice a ctb v4 file in Lychee, import it into UV Tools, generate an elephant foot calibration test and save it, the following error results:
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 1845 at UVtools.Core.FileFormats.FileFormat.Encode(String fileFullPath, OperationProgress progress) in UVtools.Core/FileFormats/FileFormat.cs:line 4559 at UVtools.UI.MainWindow.<>c__DisplayClass105_0.<SaveFile>b__2() in UVtools.UI/MainWindow.axaml.cs:line 2279
How to reproduce
see above, and the file below. using ctb v3 does not produce the error.
Files
This is your first time submitting an issue with UVtools 🥳Please review your issue and ensure that the submit template was followed, the information is complete, and not related to any other open issue. It will be reviewed shortly. Debugging is very important and make the program better. Thanks for contributing and making the software better! 🙌
I used your attached file and did the "generate an elephant foot calibration test and save it" but it does not raise any error to me. File was saved and reloaded fine. Are you sure you have the correct file attached?
Thank you for testing - I will doublecheck my file once I’m back home, tomorrow at the latest.
Yes I've doublechecked, issue remains. So to be precise:
- download the zip attached above and unzip
- open with UV Tools 5.0.7 X64 on macOS Monterey
- Calibration - Elephant foot: no change to default settings, generate Elephant foot test
- File - Save: Overwrite file? Yes
- 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 1845
at UVtools.Core.FileFormats.FileFormat.Encode(String fileFullPath, OperationProgress progress) in UVtools.Core/FileFormats/FileFormat.cs:line 4559
at UVtools.UI.MainWindow.<>c__DisplayClass105_0.<SaveFile>b__2() in UVtools.UI/MainWindow.axaml.cs:line 2279
I will now check on Windows 10 and the newest UV Tools version there.
I cannot reproduce the issue on Windows 10: good to know that it works well there.
Will reinstall on macOS Monterey and also try macOS Sequioa on another machine.
Fresh install on macOS Sequioa on different machine (iMac18,3): same issue
Reinstall on Mac Pro detailed above: same issue
Will try my third machine: macOS Sequoia, arm64
macOS Sequoia arm64 is a non-starter for me...
The problem is with lychee slicer not setting a MachineName on file, resulting somehow on a null reading. However they define a machine name address... So machinename have an address but with 0 size.
My bet is that if you try chitubox it will work
Windows and macOS have no difference in file format logic, there are no IF regarding OSes. Have you copied the problematic file or did you slice a new one under windows and lychee?
macOS Sequoia arm64 is a non-starter for me...
Never manual install UVtools on macOS, always use the auto-installer script, stated on readme page.
I used the same file in Windows, downloaded from the link above here.
Never manual install UVtools on macOS, always use the auto-installer script, stated on readme page.
I see... I assumed the zip files on the releases page could be used as-is. Installing with the script on arm64 works but issue remains. Same for reinstalling on macOS x64.
I will bring this issue to the attention of the Lychee team. By the way, I had missed that the current Lychee version is 7.2.2, but this issue is present there also.