.Net ConsoleApp in Docker error msacm32.dll missing - c#

I wrote a .Net ConspleApp using the NAudio library. If I port the code to a Docker container and run it on Linux, I get the following error message when calling the library in the code.
XML-Encoder System.DllNotFoundException: Unable to load shared library 'Msacm32.dll'
or one of its dependencies. In order to help diagnose loading problems, consider
setting the LD_DEBUG environment variable: libMsacm32.dll: cannot open shared object
file: No such file or directory
at NAudio.Wave.Compression.AcmInterop.acmFormatSuggest2(IntPtr hAcmDriver, IntPtr
sourceFormatPointer, IntPtr destFormatPointer, Int32 sizeDestFormat,
AcmFormatSuggestFlags suggestFlags)
at NAudio.Wave.Compression.AcmStream.SuggestPcmFormat(WaveFormat compressedFormat)
at NAudio.Wave.AcmMp3FrameDecompressor..ctor(WaveFormat sourceFormat)
at NAudio.Wave.Mp3FileReader.CreateAcmFrameDecompressor(WaveFormat mp3Format)
at NAudio.Wave.Mp3FileReaderBase..ctor(Stream inputStream, FrameDecompressorBuilder
frameDecompressorBuilder, Boolean ownInputStream)
at NAudio.Wave.Mp3FileReader..ctor(String mp3FileName)
at XML_Creator.CreateXml.makeXml(String inputFile, String outputFolder) in
/App/CreateXml.cs:line 94
I copy the msacm32.dll in the Dockerfile into the program directory but unfortunately it doesn't work! What am I doing wrong?
COPY msacm32.dll /App/msacm32.dll
thx

Related

Error message related to libICE.so.6 makes code to exit?

While working with avlaonia on Vscode and running it in debug. I get the below error message and the code exits and debug doesn't work.
System.DllNotFoundException: Unable to load shared library 'libICE.so.6' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable:
liblibICE.so.6: cannot open shared object file: No such file or directory
at Avalonia.X11.ICELib.IceAddConnectionWatch(IntPtr watchProc, IntPtr clientData)
at Avalonia.X11.X11PlatformLifetimeEvents..ctor(AvaloniaX11Platform platform) in /_/src/Avalonia.X11/X11PlatformLifetimeEvents.cs:line 56
at Avalonia.X11.AvaloniaX11Platform.Initialize(X11PlatformOptions options) in /_/src/Avalonia.X11/X11Platform.cs:line 71
at Avalonia.AvaloniaX11PlatformExtensions.<>c__0`1.<UseX11>b__0_0() in /_/src/Avalonia.X11/X11Platform.cs:line 279
at Avalonia.Controls.AppBuilderBase`1.Setup() in /_/src/Avalonia.Controls/AppBuilderBase.cs:line 303
at Avalonia.Controls.AppBuilderBase`1.SetupWithLifetime(IApplicationLifetime lifetime)
What does this error means, how can I managed to resolve the issue. This error appears any time I'm trying to run debug.
Try installing the package libice6:
sudo apt install libice6
For context, I just installed Linux Subsystem on Windows with Ubuntu, tried to run an avalonia program and ran into this error. It solved the problem (there was a subsequent missing library so I had to similarly run
sudo apt install libsm6
).
I hope it will help you

extracting CAB file throwing error while running as linux container

I am using SevenZipExtractor (https://www.nuget.org/packages/SevenZipExtractor/) to extract CAB files using below code, it's works on my windows machine,
using (ArchiveFile archiveFile = new ArchiveFile(#"C:\TEMP\x.cab"))
{
foreach (Entry entry in archiveFile.Entries)
{
Console.WriteLine(entry.FileName);
// extract to file
entry.Extract(entry.FileName);
}
}
While I am pushing this to Linux container, it's throws below error,
This seems the NuGet package using some internal Windows DLL.
Question: can I make some docker file change and make it running on Linux container?
> ❯ docker run -i test
Unhandled exception. SevenZipExtractor.SevenZipException: Unable to
initialize SevenZipHandle ---> System.DllNotFoundException: Unable to
load shared library 'kernel32.dll' or one of its dependencies. In
order to help diagnose loading problems, consider setting the LD_DEBUG
environment variable: libkernel32.dll: cannot open shared object file:
No such file or directory at
SevenZipExtractor.Kernel32Dll.LoadLibrary(String lpFileName) at
SevenZipExtractor.SevenZipHandle..ctor(String sevenZipLibPath) at
SevenZipExtractor.ArchiveFile.InitializeAndValidateLibrary() ---
End of inner exception stack trace --- at
SevenZipExtractor.ArchiveFile.InitializeAndValidateLibrary() at
SevenZipExtractor.ArchiveFile..ctor(String archiveFilePath, String
libraryFilePath) at ConsoleDocker.Program.Main(String[] args) in
/src/Program.cs:line 33
https://www.nuget.org/packages/SevenZipExtractor/
C# wrapper for 7z.dll (included)
You trying to use windows dll under linux.
Instead, you can use https://www.7-zip.org/sdk.html - there is pure c# code, not .dll wrapper

EnsureLibraryPresent error in huysentruitw's SapNwRfc connector with .net5

I'd like to use huysentruitw's SapNwRfc connector to connect to SAP. I have copied all the necessary files to project root (sapnwrfc.dll, icuuc50.dll, icuin50.dll, icudt50.dll) but I still got error when I try to call this:
SapLibrary.EnsureLibraryPresent();
the error I got:
System.BadImageFormatException
HResult=0x8007000B
Message=An attempt was made to load a program with an incorrect format. (0x8007000B)
Source=SapNwRfcDotNet
StackTrace:
at SapNwRfc.Internal.Interop.RfcInterop.RfcGetVersion(UInt32& majorVersion, UInt32& minorVersion, UInt32& patchLevel)
at SapNwRfc.Internal.Interop.RfcInterop.GetVersion(UInt32& majorVersion, UInt32& minorVersion, UInt32& patchLevel)
at SapNwRfc.SapLibrary.GetVersion()
at SapNwRfc.SapLibrary.EnsureLibraryPresent()
I have tried to changed platform from any CPU to x86 (then I got error from IIS Express), and x64 (the same behavior as any CPU)
Do you have any tips how to handle it?
Thank you.
EDIT
Tested with .NET Framework 4.7.2 and works fine. With Core 2.1, 3.1 and .NET5 does not work.
I have also tried it without copying the files into project folder and result is the same (files are present in System32 and SysWOW64 folders)

Unreal Engine build crashes at C# trying to open Recycle Bin file

This boggles my mind, to the point that I wonder if isn't an SDK problem.
I share an Unreal Engine (4.26) game with a (non-technical) colleague through Git. Today he received his first code files from me, and to compile it, I had him install the SDKs(windows, .Net, C++ gaming, Visual Studio) and call Generate Visual Studio Project Files. It all generated just fine.
EDIT:
Emptying the recycle bin somehow fixed it, but now the problem repeats itself:
ERROR: Unhandled exception: System.UnauthorizedAccessException: Access to the path 'D:\System Volume Information' is denied.
So this entirely seems like a permission level problem to me, but I asked him to enable developer mode, to uncheck every read-only on Epic Games and Unreal Engine, and to run it in administrator mode. Nothing works. I don't see how we can get any more permissions than this.
Former message:
ERROR: Unhandled exception: System.UnauthorizedAccessException: Access to the path 'D:$RECYCLE.BIN\S-1-5-18' is denied.
Full logfile(minus some cleanup on my part):
Log file open, 04/17/21 12:00:08
LogInit: LLM is enabled
LogInit: LLM CsvWriter: off TraceWriter: off
LogInit: Display: Running engine for game: Naptin
LogPlatformFile: Not using cached read wrapper
LogTaskGraph: Started task graph with 5 named threads and 35 total threads with 3 sets of task threads.
LogStats: Stats thread started at 5.907298
LogD3D11RHI: Loaded GFSDK_Aftermath_Lib.x64.dll
LogICUInternationalization: ICU TimeZone Detection - Raw Offset: -5:00, Platform Override: ''
LogPluginManager: Mounting plugin MeshPainting
.....lots of LogPluginManager......
LogPluginManager: Mounting plugin SteamVR
LogXGEController: Cleaning working directory: C:/Users/adpar/AppData/Local/Temp/UnrealXGEWorkingDir/
LogXGEController: Cannot use XGE Controller as Incredibuild is not installed on this machine.
LogInit: Warning: Incompatible or missing module: Naptin
Running D:/.........UNREALENGINEFOLDER/UE_4.26/Engine/Binaries/DotNET/UnrealBuildTool.exe Development Win64 -Project="D:/....UNREAL/Naptin/Naptin/Naptin.uproject" -TargetType=Editor -Progress -NoEngineChanges -NoHotReloadFromIDE
Using 'git status' to determine working set for adaptive non-unity build (D:\....UNREAL\Naptin\Naptin).
Creating makefile for NaptinEditor(no existing makefile)
#progress push 5%
Parsing headers for NaptinEditor
Running UnrealHeaderTool "D:\....UNREAL\Naptin\Naptin\Naptin.uproject" "D:\....UNREAL\Naptin\Naptin\Intermediate\Build\Win64\NaptinEditor\Development\NaptinEditor.uhtmanifest" -LogCmds="loginit warning, logexit warning, logdatabase error" -Unattended -WarningsAsErrors -abslog="C:\Users\adpar\AppData\Local\UnrealBuildTool\Log_UHT.txt" -installed
Reflection code generated for NaptinEditor in 23.9260389 seconds
#progress pop
ERROR: Unhandled exception: System.UnauthorizedAccessException: Access to the path 'D:\$RECYCLE.BIN\S-1-5-18' is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileSystemEnumerableIterator`1.CommonInit()
at System.IO.FileSystemEnumerableIterator`1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler, Boolean checkHost)
at System.IO.DirectoryInfo.EnumerateFiles()
at Tools.DotNETCommon.FileFilter.FindMatchesFromDirectory(DirectoryInfo CurrentDirectory, String NamePrefix, Boolean bIgnoreSymlinks, List`1 MatchingFileNames) in D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\DotNETCommon\DotNETUtilities\FileFilter.cs:line 487
at Tools.DotNETCommon.FileFilter.FindMatchesFromDirectory(DirectoryInfo CurrentDirectory, String NamePrefix, Boolean bIgnoreSymlinks, List`1 MatchingFileNames) in D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\DotNETCommon\DotNETUtilities\FileFilter.cs:line 495
at Tools.DotNETCommon.FileFilter.FindMatchesFromDirectory(DirectoryInfo CurrentDirectory, String NamePrefix, Boolean bIgnoreSymlinks, List`1 MatchingFileNames) in D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\DotNETCommon\DotNETUtilities\FileFilter.cs:line 495
at Tools.DotNETCommon.FileFilter.ApplyToDirectory(DirectoryReference DirectoryName, Boolean bIgnoreSymlinks) in D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\DotNETCommon\DotNETUtilities\FileFilter.cs:line 408
at Tools.DotNETCommon.FilePattern.CreateMapping(HashSet`1 Files, FilePattern& SourcePattern, FilePattern& TargetPattern) in D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\DotNETCommon\DotNETUtilities\FilePattern.cs:line 340
at UnrealBuildTool.UEBuildBinary.PrepareRuntimeDependencies(List`1 RuntimeDependencies, Dictionary`2 TargetFileToSourceFile, DirectoryReference ExeDir) in D:\Build\++UE4\Sync\Engine\Source\Programs\UnrealBuildTool\Configuration\UEBuildBinary.cs:line 294
at UnrealBuildTool.UEBuildTarget.Build(BuildConfiguration BuildConfiguration, ISourceFileWorkingSet WorkingSet, Boolean bIsAssemblingBuild, List`1 SpecificFilesToCompile) in D:\Build\++UE4\Sync\Engine\Source\Programs\UnrealBuildTool\Configuration\UEBuildTarget.cs:line 1786
at UnrealBuildTool.BuildMode.CreateMakefile(BuildConfiguration BuildConfiguration, TargetDescriptor TargetDescriptor, ISourceFileWorkingSet WorkingSet) in D:\Build\++UE4\Sync\Engine\Source\Programs\UnrealBuildTool\Modes\BuildMode.cs:line 615
at UnrealBuildTool.BuildMode.Build(List`1 TargetDescriptors, BuildConfiguration BuildConfiguration, ISourceFileWorkingSet WorkingSet, BuildOptions Options, FileReference WriteOutdatedActionsFile, Boolean bSkipPreBuildTargets) in D:\Build\++UE4\Sync\Engine\Source\Programs\UnrealBuildTool\Modes\BuildMode.cs:line 257
at UnrealBuildTool.BuildMode.Execute(CommandLineArguments Arguments) in D:\Build\++UE4\Sync\Engine\Source\Programs\UnrealBuildTool\Modes\BuildMode.cs:line 226
at UnrealBuildTool.UnrealBuildTool.Main(String[] ArgumentsArray) in D:\Build\++UE4\Sync\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.cs:line 550
LogInit: Warning: Still incompatible or missing module: Naptin
LogCore: Engine exit requested (reason: EngineExit() was called)
LogExit: Preparing to exit.
LogExit: Exiting.
Log file closed, 04/17/21 12:02:43
We have tried a few things, like generating again, or copypasting all of our assets to a new project: if we copy the assets, all good, if we copy the code, the same crash.
This happens only on his machine, so I'm kind of at a loss for words. He did not delete any files, the only difference between his machine and mine is that his SDK is more up-to-date by a few weeks.
I'd really appreciate any clue regarding why this file comes up in the build or how to stop it from crashing. The C++ code doesn't seem to be the issue at all, and he can't start Unreal Engine anymore.

Android build error "failed to create JavaTypeInfo for class" :Xamarin

Following this tutorial https://github.com/Vidyo/vidyo.io-connector-xamarin I downloaded the app without making any changes.
When I build the app, I get the following error:
Severity Code Description Project File Line Suppression State
Error Failed to create JavaTypeInfo for class: Android.Support.V4.View.Accessibility.AccessibilityManagerCompat/ITouchExplorationStateChangeListenerImplementor due to MAX_PATH: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\User\Desktop\vidyo.io-connector-xamarin-master\vidyo.io-connector-xamarin-master\VidyoConnector.Android\obj\Debug\90\android\src\mono\android\support\v4\view\accessibility\AccessibilityManagerCompat_TouchExplorationStateChangeListenerImplementor.java'.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalDelete(String path, Boolean checkHost)
at System.IO.File.Delete(String path)
at Xamarin.Android.Tools.Files.CopyIfStreamChanged(Stream stream, String destination)
at Xamarin.Android.Tasks.Generator.CreateJavaSources(TaskLoggingHelper log, IEnumerable`1 javaTypes, String outputPath, String applicationJavaClass, String androidSdkPlatform, Boolean useSharedRuntime, Boolean generateOnCreateOverrides, Boolean hasExportReference) VidyoConnector.Android
What is the possible fix for this?
That seems a problem with long path in windows. Put the project folder on the root, say C://yourproject. Then, clean your solution and build.
#LawrenceWlt is correct but I would like to add some more information.
Is is due to Maximum Path Length Limitation
In the Windows API (with some exceptions discussed in the following
paragraphs), the maximum length for a path is MAX_PATH, which is
defined as 260 characters.
https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation
https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#maximum-path-length-limitation
If you are on Windows 10, Version 1607 or later you can Enable Long Paths:
The registry key Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled (Type: REG_DWORD) must exist and be set to 1.
The application manifest must also include the longPathAware element.
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings xmlns:ws2="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
<ws2:longPathAware>true</ws2:longPathAware>
</windowsSettings>
</application>
https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation#enable-long-paths-in-windows-10-version-1607-and-later
I got a similar error from Experimental Mobile Blazor Bindings:
https://github.com/xamarin/MobileBlazorBindings
Failed to generate Java type for class:
Android.Support.V4.View.Accessibility.AccessibilityManagerCompat/IAccessibilityStateChangeListenerImplementor
due to MAX_PATH: System.IO.DirectoryNotFoundException: Could not find
a part of the path
'C:\Users\User\Desktop\MobileBlazorBindings-master\samples\MobileBlazorBindingsXaminals\MobileBlazorBindingsXaminals.Android\obj\Debug\90\android\src\mono\android\support\v4\view\accessibility\AccessibilityManagerCompat_AccessibilityStateChangeListenerImplementor.java'.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalDelete(String path, Boolean checkHost) at
System.IO.File.Delete(String path) at
Xamarin.Android.Tools.Files.CopyIfStreamChanged(Stream stream, String
destination) at
Xamarin.Android.Tasks.GenerateJavaStubs.CreateJavaSources(IEnumerable`1
javaTypes, TypeDefinitionCache
cache) MobileBlazorBindingsXaminals.Android
Adding this to the Android projects's .csproj file fixed the issue for me:
<PropertyGroup>
<IntermediateOutputPath>C:\E</IntermediateOutputPath>
</PropertyGroup>
It writes the intermediate Android files to a folder of your choice - obviously choose a really short one to avoid long paths!
There is another solution that hasn't been mentioned yet: Create a Directory Junction and point it to your solution directory. Place the junction at the root-level, then run the solution from there.
This approach will enable you to workaround the MAX_PATH issue without having to move your project or upgrade to Windows 10.
For example, let's say you store all your code in C:\dev, all your repos in C:\dev\repos, all your Git repos in C:\dev\repos\git, all your Xamarin Git repos in C:\dev\repos\git\xamarin, and all the mobile apps you've built for your largest client in C:\dev\repos\git\xamarin\isis (hey it's not my place to judge). Your latest project can be found in C:\dev\repos\git\xamarin\isis\satellite-tracker\src, but you can't get it to build because the path is too long.
So we create a new directory, C:\J, which will hold this and any other junctions we create for this workaround on other projects. Then open a command prompt as Administrator and navigate to C:\J. Then enter the following command:
mklink /J SatTrack C:\dev\repos\git\xamarin\isis\satellite-tracker\src
Now you can access your solution file from C:\J\SatTrack. If you open it from there, Visual Studio will use that path instead of the longer one and you should be fine after a clean/rebuild.
A simple solution that works great is changing the build output folder in Android Project -> Properties -> Build -> Output path

Categories