MSI Yükleyici Oluştururken Eksik DLL'ler
Bir MSI yükleyici oluştururken, aşağıdaki istisnayla karşılaşabilirsiniz:
2025-01-27 16:57:23 - Error: IronBarCodeDetection.Exceptions.IronBarcodeDetectionException: Unexpected error occurred during execution of the IronBarcode Machine Learning library. Please provide details to support@ironsoftware.com for a resolution. ---> System.TypeInitializationException: The type initializer for 'Microsoft.ML.OnnxRuntime.NativeMethods' threw an exception. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.ML.OnnxRuntime.NativeMethods..cctor()
--- End of inner exception stack trace ---
at Microsoft.ML.OnnxRuntime.SessionOptions..ctor()
at Iron.BarCode.Extensions.xjtagg`1..ctor(Stream dfepdx, SessionOptions dfepdy)
at IronBarCodeDetection.BarcodeDetect.PredictObject[TModel](Stream modelStream)
--- End of inner exception stack trace ---
at IronBarCodeDetection.BarcodeDetect.PredictObject[TModel](Stream modelStream)
at IronBarCodeDetection.BarcodeDetect.DetectBarCode()
at Iron.BarCode.Extensions.cuewjf.ehxbbs(BarcodeDetect tlxjvd)
at Iron.BarCode.Extensions.cuewjf.ehxbbr(AnyBitmap tlxjvd, Double tlxjve)
at Iron.BarCode.Extensions.cuewjo.mvanli(AnyBitmap tlxjvd, Double tlxjve)
at Iron.BarCode.Extensions.cuewjo.mvanlf(Image`1 tlxjvd)
at Iron.BarCode.Extensions.cuewjo.mvankh(Object tlxjvd)
at IronBarCode.BarcodeReader.Read(AnyBitmap inputImage, BarcodeReaderOptions barcodeReaderOptions)
at WindowsFormsBarcode.Form1.btnBrowse_Click_1(Object sender, EventArgs e)
2025-01-27 16:57:23 - Error Message: Unexpected error occurred during execution of the IronBarcode Machine Learning library. Please provide details to support@ironsoftware.com for a resolution.
2025-01-27 16:57:23 - Inner Exception: The type initializer for 'Microsoft.ML.OnnxRuntime.NativeMethods' threw an exception.
2025-01-27 16:57:23 - Inner Exception Stack Trace: at Microsoft.ML.OnnxRuntime.SessionOptions..ctor()
at Iron.BarCode.Extensions.xjtagg`1..ctor(Stream dfepdx, SessionOptions dfepdy)
at IronBarCodeDetection.BarcodeDetect.PredictObject[TModel](Stream modelStream)
Sebep
Bu hata, kütüphanenin düzgün çalışması için gerekli dosyaları bulamaması nedeniyle oluşur.
Çözüm
MSI yükleyicisinin sorunsuz çalışmasını sağlamak için, kurulum projenize aşağıdaki üç dosyayı eklemelisiniz: onnxruntime.dll, IronBarcodeInterop.dll ve ReaderInterop.dll. Bu dosyalar, projeyi Yayın modunda derlediğinizde üretilir:
onnxruntime.dll: MsiInstallerSample\MsiInstallerSample\bin\Release adresinde bulunurIronBarcodeInterop.dll: MsiInstallerSample\MsiInstallerSample\bin\Release\runtimes\win-x86\native adresinde bulunurReaderInterop.dll: MsiInstallerSample\MsiInstallerSample\bin\Release\runtimes\win-x86\native adresinde bulunur
Bu üç dosyanın da Kurulum Projenize eklendiğinden emin olun, böylece bu istisnayı önleyebilirsiniz.
Curtis Chau, Bilgisayar Bilimleri alanında Lisans Derecesine (Carleton Üniversitesi) sahip ve Node.js, TypeScript, JavaScript ve React konularında uzmanlaşmış ön uç geliştirmeyle ilgileniyor. Sezgisel ve estetik açıdan hoş kullanıcı arayüzleri oluşturma tutkunu, Curtis modern çerçevelerle çalışmayı ve iyi yapılandırılmış, görsel olarak çekici kılavuzlar oluşturmayı seviyor.