Project

Profile

Help

Bug #5295

closed

System.Reflection.TargetInvocationException when trying to run SaxonCS 11.1 on Windows and Linux from command line

Added by Martin Honnen about 2 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Category:
Command Line
Sprint/Milestone:
Start date:
2022-02-08
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
11
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:
.NET

Description

As explained in https://saxonica.plan.io/boards/3/topics/8450, I am not able to run the SaxonCS 11.1 .NET release from the command line on Windows, it gives a System.Reflection.TargetInvocationException.

An additional test on Linux also failed with the same exception.

Details:

PS C:\Users\Martin Honnen\OneDrive\Documents\xslt> & 'C:\Program Files\Saxonica\SaxonCS-11.1\SaxonCS.exe' query -t -qs:"current-dateTime()"
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.ArgumentException: The path is empty. (Parameter 'path')
   at System.IO.Path.GetFullPath(String path)
   at System.Diagnostics.FileVersionInfo.GetVersionInfo(String fileName)
   at Org.XmlResolver.XmlResolverConfiguration..ctor(List`1 propertyFiles, List`1 catalogFiles)
   at Saxon.Callbacks.CatalogResourceResolver..ctor()
   at Saxon.Hej.Configuration.init()
   at Saxon.Hej.Configuration..ctor()
   at Saxon.Eej.config.ProfessionalConfiguration..ctor()
   at Saxon.Eej.config.EnterpriseConfiguration..ctor()
   --- End of inner exception stack trace ---
   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean wrapExceptions, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& hasNoDefaultCtor)
   at System.RuntimeType.CreateInstanceDefaultCtorSlow(Boolean publicOnly, Boolean wrapExceptions, Boolean fillCache)
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, Boolean   at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions)
   at System.Activator.CreateInstance(Type type)
   at Saxon.Hej.Configuration.newConfiguration()
Unhandled exception. System.Exception: Cannot instantiate a Configuration
 ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.ArgumentException: The path is empty. (Parameter 'path')
   at System.IO.Path.GetFullPath(String path)
   at System.Diagnostics.FileVersionInfo.GetVersionInfo(String fileName)
   at Org.XmlResolver.XmlResolverConfiguration..ctor(List`1 propertyFiles, List`1 catalogFiles)
   at Saxon.Callbacks.CatalogResourceResolver..ctor()
   at Saxon.Hej.Configuration.init()
   at Saxon.Hej.Configuration..ctor()
   at Saxon.Eej.config.ProfessionalConfiguration..ctor()
   at Saxon.Eej.config.EnterpriseConfiguration..ctor()
   --- End of inner exception stack trace ---
   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean wrapExceptions, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& hasNoDefaultCtor)
   at System.RuntimeType.CreateInstanceDefaultCtorSlow(Boolean publicOnly, Boolean wrapExceptions, Boolean fillCache)
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, Boolean wrapExceptions)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions)
   at System.Activator.CreateInstance(Type type)
   at Saxon.Hej.Configuration.newConfiguration()
   --- End of inner exception stack trace ---
   at Saxon.Hej.Configuration.newConfiguration()
   at Saxon.Hej.Query.doQuery(String[] args, String command)
   at Saxon.Hej.Query.main(String[] args)
   at Saxon.Cmd.Command.Main(String[] args)

Or using transform:

PS C:\Users\Martin Honnen\OneDrive\Documents\xslt> & 'C:\Program Files\Saxonica\SaxonCS-11.1\SaxonCS.exe' transform -t -xsl:.\processorTest3.xml -s:.\processorTest3.xml
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.ArgumentException: The path is empty. (Parameter 'path')
   at System.IO.Path.GetFullPath(String path)
...

With Ubuntu Linux 20.04:

mh@liberty-main-hp:~$ /opt/SaxonCS-11.1/SaxonCS query -t -qs:'current-dateTime()'
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.ArgumentException: The path is empty. (Parameter 'path')
   at System.IO.Path.GetFullPath(String path)
   at System.Diagnostics.FileVersionInfo.GetVersionInfo(String fileName)
   at Org.XmlResolver.XmlResolverConfiguration..ctor(List`1 propertyFiles, List`1 catalogFiles)
   at Saxon.Callbacks.CatalogResourceResolver..ctor()
   at Saxon.Hej.Configuration.init()
   at Saxon.Hej.Configuration..ctor()
   at Saxon.Eej.config.ProfessionalConfiguration..ctor()
   at Saxon.Eej.config.EnterpriseConfiguration..ctor()
   --- End of inner exception stack trace ---
   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean wrapExceptions, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& hasNoDefaultCtor)
   at System.RuntimeType.CreateInstanceDefaultCtorSlow(Boolean publicOnly, Boolean wrapExceptions, Boolean fillCache)
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, Boolean wrapExceptions)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions)
   at System.Activator.CreateInstance(Type type)
   at Saxon.Hej.Configuration.newConfiguration()
Unhandled exception. System.Exception: Cannot instantiate a Configuration
 ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.ArgumentException: The path is empty. (Parameter 'path')
   at System.IO.Path.GetFullPath(String path)
   at System.Diagnostics.FileVersionInfo.GetVersionInfo(String fileName)
   at Org.XmlResolver.XmlResolverConfiguration..ctor(List`1 propertyFiles, List`1 catalogFiles)
   at Saxon.Callbacks.CatalogResourceResolver..ctor()
   at Saxon.Hej.Configuration.init()
   at Saxon.Hej.Configuration..ctor()
   at Saxon.Eej.config.ProfessionalConfiguration..ctor()
   at Saxon.Eej.config.EnterpriseConfiguration..ctor()
   --- End of inner exception stack trace ---
   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean wrapExceptions, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& hasNoDefaultCtor)
   at System.RuntimeType.CreateInstanceDefaultCtorSlow(Boolean publicOnly, Boolean wrapExceptions, Boolean fillCache)
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, Boolean wrapExceptions)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions)
   at System.Activator.CreateInstance(Type type)
   at Saxon.Hej.Configuration.newConfiguration()
   --- End of inner exception stack trace ---
   at Saxon.Hej.Configuration.newConfiguration()
   at Saxon.Hej.Query.doQuery(String[] args, String command)
   at Saxon.Hej.Query.main(String[] args)
   at Saxon.Cmd.Command.Main(String[] args)
Aborted
Actions #1

Updated by Michael Kay about 2 years ago

  • Assignee set to Norm Tovey-Walsh
Actions #2

Updated by Norm Tovey-Walsh about 2 years ago

  • Status changed from New to In Progress

It's interesting that it only happens with the built solution and it doesn't happen on the Mac...

Actions #3

Updated by Norm Tovey-Walsh about 2 years ago

The culprit is the attempt in the XmlResolver to find its version with FileVersionInfo.GetVersionInfo(assembly.Location). In the published executable, assembly.Location isn't set and it all goes sideways.

Actions #4

Updated by Norm Tovey-Walsh about 2 years ago

  • Status changed from In Progress to Resolved

Upgraded to XmlResolver 1.1.0 which fixes the problem.

Actions #5

Updated by Norm Tovey-Walsh about 2 years ago

  • Status changed from Resolved to Closed
  • Fixed in Maintenance Release 11.2 added

Please register to edit this issue

Also available in: Atom PDF