-
-
Notifications
You must be signed in to change notification settings - Fork 7
🚧Bug not finding native libs #373
Description
Complete The Item Below
- I have updated the title without removing the 🚧 emoji.
Description
When creating a self-contained or single-file build using dotnet publish, the error below is thrown.
The reason for this is because with those builds, the native libraries are published into the same location as the executable. The NativeLibraryLoader implementation is registered into the IoC container. When the container is resolved, it executes the code which looks for the native libraries but those libraries do not exist because the location it is looking for them is runtimes/win-x64/native.
We need to resolve the libraries differently and change how the native libraries are processed and used for all of the types of available publishing methods.
Error with self-contained and single-file publish builds.
Unhandled exception. SimpleInjector.ActivationException: The configuration is invalid. Creating the instance for type ALC failed. Could not find the library 'soft_oal.dll' in directory path 'K:/SOFTWARE-DEVELOPMENT/PERSONAL/CASL/Testing/CASLTesting/bin/Release/net8.0/win-x64/publish/runtimes/win-x64/native' Verification was triggered because Container.Options.EnableAutoVerification was enabled. To prevent the container from being verified on first resolve, set Container.Options.EnableAutoVerification to false.
---> System.InvalidOperationException: The configuration is invalid. Creating the instance for type ALC failed. Could not find the library 'soft_oal.dll' in directory path 'K:/SOFTWARE-DEVELOPMENT/PERSONAL/CASL/Testing/CASLTesting/bin/Release/net8.0/win-x64/publish/runtimes/win-x64/native'
---> SimpleInjector.ActivationException: Could not find the library 'soft_oal.dll' in directory path 'K:/SOFTWARE-DEVELOPMENT/PERSONAL/CASL/Testing/CASLTesting/bin/Release/net8.0/win-x64/publish/runtimes/win-x64/native'
---> System.IO.FileNotFoundException: Could not find the library 'soft_oal.dll' in directory path 'K:/SOFTWARE-DEVELOPMENT/PERSONAL/CASL/Testing/CASLTesting/bin/Release/net8.0/win-x64/publish/runtimes/win-x64/native'
File name: 'K:/SOFTWARE-DEVELOPMENT/PERSONAL/CASL/Testing/CASLTesting/bin/Release/net8.0/win-x64/publish/runtimes/win-x64/native/soft_oal.dll'
at CASL.NativeInterop.NativeLibraryLoader.LoadLibrary() in K:\SOFTWARE-DEVELOPMENT\PERSONAL\CASL\CASL\NativeInterop\NativeLibraryLoader.cs:line 90
at CASL.OpenAL.ALC..ctor(ILibraryLoader libraryLoader, IDelegateFactory delegateFactory) in K:\SOFTWARE-DEVELOPMENT\PERSONAL\CASL\CASL\OpenAL\ALC.cs:line 38
at lambda_method15(Closure)
at SimpleInjector.Lifestyles.SingletonLifestyle.SingletonRegistration.Execute(Func`1 instanceCreator)
at SimpleInjector.Lifestyles.SingletonLifestyle.SingletonRegistration.GetInterceptedInstanceWithNullCheck()
at SimpleInjector.Lifestyles.SingletonLifestyle.SingletonRegistration.GetInterceptedInstance()
at SimpleInjector.Lifestyles.SingletonLifestyle.SingletonRegistration.BuildExpression()
at SimpleInjector.InstanceProducer.BuildExpressionInternal()
at SimpleInjector.Internals.LazyEx`1.InitializeAndReturn()
at SimpleInjector.InstanceProducer.BuildExpression()
--- End of inner exception stack trace ---
at SimpleInjector.InstanceProducer.BuildExpression()
at SimpleInjector.InstanceProducer.VerifyExpressionBuilding()
--- End of inner exception stack trace ---
at SimpleInjector.InstanceProducer.VerifyExpressionBuilding()
at SimpleInjector.Container.VerifyThatAllExpressionsCanBeBuilt(InstanceProducer[] producersToVerify)
at SimpleInjector.Container.VerifyThatAllExpressionsCanBeBuilt()
at SimpleInjector.Container.VerifyInternal(Boolean suppressLifestyleMismatchVerification)
at SimpleInjector.Container.Verify(VerificationOption option)
at SimpleInjector.Container.Verify()
at SimpleInjector.Container.NotifyAndLock()
--- End of inner exception stack trace ---
at SimpleInjector.Container.NotifyAndLock()
at SimpleInjector.Container.GetInstance[TService]()
at CASL.IoC.get_Container() in K:\SOFTWARE-DEVELOPMENT\PERSONAL\CASL\CASL\IoC.cs:line 48
at CASL.Audio..ctor(String filePath, BufferType bufferType) in K:\SOFTWARE-DEVELOPMENT\PERSONAL\CASL\CASL\Audio.cs:line 65
at CASLTesting.OptionsProcessor.SetDefaultSoundFile() in K:\SOFTWARE-DEVELOPMENT\PERSONAL\CASL\Testing\CASLTesting\OptionsProcessor.cs:line 544
at CASLTesting.OptionsProcessor.ProcessOptions() in K:\SOFTWARE-DEVELOPMENT\PERSONAL\CASL\Testing\CASLTesting\OptionsProcessor.cs:line 72
at CASLTesting.Program.Main(String[] args) in K:\SOFTWARE-DEVELOPMENT\PERSONAL\CASL\Testing\CASLTesting\Program.cs:line 33Acceptance Criteria
### The items to complete to satisfy the Definition of Done.
- [x] All the unit tests have been executed and passed locally after the PR work is complete. _(Why? Refer to 'Additional Information' below.)_
- [x] Fix issue with native library
- [x] Full testing with Velaptor and publishing tested and working
ToDo Items
### The items to complete to satisfy the Definition of Done.
- [x] Add a change type label to the issue. Refer to the _**Change Type Labels**_ section below.
- [x] Add a priority label to the issue. Refer to the _**Priority Type Labels**_ section below.
- [x] Link the issue to the correct milestone _(if applicable)_.
Issue Dependencies
No response
Related Work
No response
Additional Information:
Unit Tests
Reasons for local unit test execution:
- Unit tests might pass locally but not in the CI environment during the status check process or vice-versa.
- Tests might pass on the developer's machine but not necessarily on the code reviewer's machine.
- If you notice that the test status check has passed but the test failed locally, please notify a project maintainer!
💡Warning💡
If the unit tests pass remotely and are not executed locally, this means we could be letting a bug slip into production.
Though bugs will always exist in some capacity, we should all do our part to help prevent them from happening.
Change Type Labels
| Change Type | Label |
|---|---|
| Bug Fixes | 🐛bug |
| Breaking Changes | 🧨breaking-changes |
| New Feature | ✨new-feature |
| CICD Changes | ♻️cicd |
| Config Changes | ⚙️config |
| Performance Improvements | 🏎️performance |
| Code Doc Changes | 🗒️documentation/code |
| Product Doc Changes | 📝documentation/product |
Priority Type Labels
| Priority Type | Label |
|---|---|
| Low Priority | low priority |
| Medium Priority | medium priority |
| High Priority | high priority |
Code of Conduct
- I agree to follow this project's Code of Conduct.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status