[ome-devel] [ome-files] Getting Exceptions When Opening Files for setId(...)

Dennis Ai dennis.ai at sri.com
Sun Feb 18 20:08:25 GMT 2018


Hi Roger,

Sorry for the late reply.  Have been working on other non-related tasks lately, and it took me a while how to figure out how to get Visual Studio to step into ome-files code.  Here are the results.

=======================================================================
Breakpoint at ome/common/module.cpp#L404
It turns out that module references three environment variables, module.envvar="OME_XML_SCHEMADIR", module.module_envvar="OME_XML_HOME", and module.root_envvar="OME_HOME".  Given that we were setting OME_FILES_HOME variable before, it makes sense that all these checks were being skipped.  If I set OME_XML_HOME, then:

home evaluates to C:\Users\...\Documents\Visual Studio 2015\Projects\OMEFilesSharp\External\ome-filesd"
home /= module.relpath evaluates to C:\Users\...\Documents\Visual Studio 2015\Projects\OMEFilesSharp\External\ome-filesd\share/xml/ome

If I type that joined path into explorer, it takes me to the right directory.  Everything else checks out, the path gets resolved, module.realpath is returned, and my unit test that runs open() succeeds.  Thanks so much for your help!

I am curious though, is there a production solution that doesn't require setting an environment variable?

Thanks,
Dennis

-----Original Message-----
From: ome-devel [mailto:ome-devel-bounces at lists.openmicroscopy.org.uk] On Behalf Of Roger Leigh
Sent: Thursday, February 1, 2018 8:33 AM
To: ome-devel at lists.openmicroscopy.org.uk
Subject: Re: [ome-devel] [ome-files] Getting Exceptions When Opening Files for setId(...)

On 29/01/18 17:09, Dennis Ai wrote:
> Hi Roger,
>
> 1.I tried to set my environment variable OME_FILES_HOME to the root 
> directory where I extracted the binary distribution.
> (“C:\Users\...\Documents\Visual Studio 
> 2015\Projects\OMEFilesSharp\External\ome-files”).  This gives me the 
> same exception as before.

> 2.I was able to inspect the what() of the std::runtime_error and the 
> message says, “Could not determine runtime path for 
> “ome-xml-schema”directory”.

Thanks, this looks fairly conclusive for why things are failing.

> 3.Seeing this, I tried to set the environment variable 
> OME_XML_SCHEMADIR to “C:\Users\...\Documents\Visual Studio 
> 2015\Projects\OMEFilesSharp\External\ome-files\share\xml\ome” and that 
> resulted in the same exception as before.

Could you try with the debugger and check this line:

https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fome%2Fome-common-cpp%2Fblob%2Fv5.5.0%2Flib%2Fome%2Fcommon%2Fmodule.cpp%23L404&data=02%7C01%7Cdennis.ai%40sri.com%7C2bfa8ea8c2a24a51da2308d56991816c%7C33e743b6e43c4539bcc4a8deea6d574e%7C1%7C1%7C636530996028886359&sdata=O1tQhuE8LwwqMcF8uHuTdDZOk%2F6LzDajAyWGrm9pKgo%3D&reserved=0

Is the environment variable being used?  What are the home and module.relpath variables inside this block set to.  Does this path exist, or is it invalid?

> 4.I confirmed that I have the same files in the directories you 
> described below.

It certainly looks like something is wrong with the path lookups and/or validation.

If you can run your code in the debugger, would it be possible to look at these:

a) the path being passed to the validate_path() function.


https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fome%2Fome-common-cpp%2Fblob%2Fv5.5.0%2Flib%2Fome%2Fcommon%2Fmodule.cpp%23L71&data=02%7C01%7Cdennis.ai%40sri.com%7C2bfa8ea8c2a24a51da2308d56991816c%7C33e743b6e43c4539bcc4a8deea6d574e%7C1%7C1%7C636530996028886359&sdata=%2B9d967ddePmIGWr%2BcpXKove05eFHELi2%2FG%2F0AzhyBhA%3D&reserved=0

    Can you set a breakpoint or watchpoint here and list the paths which are being passed in for checking?  This would indicate if the paths are correct or have been messed up somehow.

b) the steps to resolve the path


https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fome%2Fome-common-cpp%2Fblob%2Fv5.5.0%2Flib%2Fome%2Fcommon%2Fmodule.cpp%23L373&data=02%7C01%7Cdennis.ai%40sri.com%7C2bfa8ea8c2a24a51da2308d56991816c%7C33e743b6e43c4539bcc4a8deea6d574e%7C1%7C1%7C636530996028886359&sdata=r4YFHKP%2BxDVFY%2FXKgX62EyR7tzOjAI%2BvF5vYNuEvDMY%3D&reserved=0

    Can you set a watch on module.realpath or set a breakpoint after each check block and print out the value each time?

c) The DLL Library path


https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fome%2Fome-common-cpp%2Fblob%2Fv5.5.0%2Flib%2Fome%2Fcommon%2Fmodule.cpp%23L451&data=02%7C01%7Cdennis.ai%40sri.com%7C2bfa8ea8c2a24a51da2308d56991816c%7C33e743b6e43c4539bcc4a8deea6d574e%7C1%7C1%7C636530996028886359&sdata=%2BYhtJHz%2F5UQ7NsxGLZ4c5SJ2AIECJKdQXQckUjWzda8%3D&reserved=0

    Can you print out module_lib_path, moduledir and libdir in this section?

    (I'd expect these to be wrong, but it would be useful to know if it's reporting the paths relative to your OMEFiles.dll)

> Any idea why I might still be running into issues?  I’m happy to send 
> you the source code if it might help figure out what’s going on.

I can certainly take a look if you like.

I'm suspicious that when you link the static libraries into your OMEFiles.dll that you're breaking the assumptions made by the code since the data file paths are relative to the static libs and not the DLL.
But... the environment variable should have overridden all this, and I don't understand why it's ignoring the environment variable.  If you could possibly try to get the debug information requested above, that might help explain what's happening.



Regards,
Roger

--
Dr Roger Leigh -- Open Microscopy Environment Wellcome Trust Centre for Gene Regulation and Expression, College of Life Sciences, University of Dundee, Dow Street,
Dundee DD1 5EH Scotland UK   Tel: (01382) 386364

The University of Dundee is a registered Scottish Charity, No: SC015096 _______________________________________________
ome-devel mailing list
ome-devel at lists.openmicroscopy.org.uk
https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.openmicroscopy.org.uk%2Fmailman%2Flistinfo%2Fome-devel&data=02%7C01%7Cdennis.ai%40sri.com%7C2bfa8ea8c2a24a51da2308d56991816c%7C33e743b6e43c4539bcc4a8deea6d574e%7C1%7C1%7C636530996028886359&sdata=amsbexYn31TDqEcSrUYniY4Ovo8Jz%2FMBX5kIjvw6ul8%3D&reserved=0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5112 bytes
Desc: not available
URL: <http://lists.openmicroscopy.org.uk/pipermail/ome-devel/attachments/20180218/25f36572/attachment.p7s>


More information about the ome-devel mailing list