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

MacOS, libraries only accessible by Mono runtime but not .NET Core #3

Open
nwamsley1 opened this issue Feb 13, 2023 · 0 comments
Open

Comments

@nwamsley1
Copy link

nwamsley1 commented Feb 13, 2023

Using the NetStandard20 .dlls under thermofisherlsms/RawFileReader/libs/NetStandard20 and on the following platform

Platform Info:
  OS: macOS (x86_64-apple-darwin21.4.0)
  CPU: 16 × Intel(R) Core(TM) i7-10700K CPU @ 3.80GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.1 (ORCJIT, skylake)
  Threads: 1 on 16 virtual cores

I get an error if I do not use the mono runtime. A working example using the mono runtime:

python3> import pythonnet
python3> import clr
python3> clr.AddReference('/Users/n.t.wamsley/Projects/Julia_Testing/ThermoFisher.CommonCore.RawFileReader')
python3> from ThermoFisher.CommonCore.RawFileReader import RawFileReaderAdapter
python3> rawFile = RawFileReaderAdapter.FileFactory("/Users/n.t.wamsley/Projects/SAGE_TESTING/MA4358_FFPE_HPVpos_01_071522.raw")

python3> print("Is Open? ", rawFile.IsOpen)
Is Open?  True
python3>print("Is Error? ", rawFile.IsError)
Is Error?  False

python3> pythonnet.get_runtime_info()
RuntimeInfo(kind='Mono', version='6.12.0.182 (2020-02/6051b710727)', initialized=True, shutdown=False)

This works. However, the following results in an error.

python3> import pythonnet
python3> from pythonnet import load
python3> load("coreclr")
python3> pythonnet.get_runtime_info()
RuntimeInfo(kind='CoreCLR', version='<undefined>', initialized=True, shutdown=False)
import clr

python3> clr.AddReference('/Users/n.t.wamsley/Projects/Julia_Testing/ThermoFisher.CommonCore.RawFileReader')
python3> from ThermoFisher.CommonCore.RawFileReader import RawFileReaderAdapter
python3> rawFile = RawFileReaderAdapter.FileFactory("/Users/n.t.wamsley/Projects/SAGE_TESTING/MA4358_FFPE_HPVpos_01_071522.raw")

python3> print("Is Open? ", rawFile.IsOpen)
Is Open?  False
python3> print("Is Error? ", rawFile.IsError)
Is Open?  True

I can further diagnose as follows.

python3> rawFile.FileError.WarningMessage

'Information: Creating mutex for: /Users/n.t.wamsley/Projects/SAGE_TESTING/MA4358_FFPE_HPVpos_01_071522.raw\nInformation: Created mutex for: /Users/n.t.wamsley/Projects/SAGE_TESTING/MA4358_FFPE_HPVpos_01_071522.raw\nInformation: Release mutex for: /Users/n.t.wamsley/Projects/SAGE_TESTING/MA4358_FFPE_HPVpos_01_071522.raw\nInformation: Close mutex for: /Users/n.t.wamsley/Projects/SAGE_TESTING/MA4358_FFPE_HPVpos_01_071522.raw\n'

python3> rawFile.FileError.ErrorMessage
' /Users/n.t.wamsley/Projects/SAGE_TESTING/MA4358_FFPE_HPVpos_01_071522.raw'

Note the leading space prepended to the filename in the error message. I can replicate this same error in the Julia programming language using a package, "DotNET.jl" that provides interop between Julia and Common Language Runtime.

julia> using DotNET
julia> reader = T"System.Reflection.Assembly".LoadFrom(raw"/Users/n.t.wamsley/Projects/Julia_Testing/ThermoFisher.CommonCore.RawFileReader.dll")
julia> rawfilereaderadapter = reader.GetType("ThermoFisher.CommonCore.RawFileReader.RawFileReaderAdapter", true, true)
julia> filefactory = rawfilereaderadapter.GetMethod("FileFactory")
julia> filepath = convert(CLRObject, raw"/Users/n.t.wamsley/Projects/SAGE_TESTING/MA4358_FFPE_HPVpos_01_071522.raw")
julia> raw_file = filefactory.Invoke(filefactory, [filepath])

julia> raw_file.FileError.WarningMessage
"Information: Creating mutex for: /Users/n.t.wamsley/Projects/SAGE_TESTING/MA4358_FFPE_HPVpos_01_071522.raw\nInformation: Created mutex for: /Users/n.t.wamsley/Projects/SAGE_TESTING/MA4358_FFPE_HPVpos_01_071522.raw\nInformation: Release mutex for: /Users/n.t.wamsley/Projects/SAGE_TESTING/MA4358_FFPE_HPVpos_01_071522.raw\nInformation: Close mutex for: /Users/n.t.wamsley/Projects/SAGE_TESTING/MA4358_FFPE_HPVpos_01_071522.raw\n"

julia> raw_file.FileError.ErrorMessage
" /Users/n.t.wamsley/Projects/SAGE_TESTING/MA4358_FFPE_HPVpos_01_071522.raw"

Note again the leading space prepended to the file name. I am not sure what is causing this error, but with python at least, I need mono to use the libraries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant