You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Error running scriptcs when the full path to the file is provided #840
# ashutoshraina at INAshutosr.local in ~/Projects/Scripts [20:23:51]
$ scriptcs HelloWorld.csx
Hello World
was ok.
However, something like
# ashutoshraina at INAshutosr.local in ~ [20:22:36]
$ scriptcs "/Users/ashutoshraina/Projects/Scripts/HelloWorld.csx"
Parameter "Users/ashutoshraina/Projects/Scripts/HelloWorld.csx" is not supported!
Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object
at ScriptCs.Argument.ArgumentHandler.Parse (System.String[] args) [0x00000] in <filename unknown>:0
at ScriptCs.Program.ParseArguments (System.String[] args) [0x00000] in <filename unknown>:0
at ScriptCs.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object
at ScriptCs.Argument.ArgumentHandler.Parse (System.String[] args) [0x00000] in <filename unknown>:0
at ScriptCs.Program.ParseArguments (System.String[] args) [0x00000] in <filename unknown>:0
at ScriptCs.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
was not ok.
I would expect this to work by default.
Note : I am on a mac.
this works with the -script parameter.
We can then provide the full path and it picks it up correctly, I checked the usual things like script packs are also loaded correctly.
DEBUG: Resolving IAppDomainAssemblyResolver
DEBUG: Registering initialization services
DEBUG: Registering default: ScriptCs.Contracts.IFileSystem
DEBUG: Registering default: ScriptCs.Contracts.IAssemblyUtility
DEBUG: Registering default: ScriptCs.Contracts.IPackageContainer
DEBUG: Registering default: ScriptCs.Contracts.IPackageAssemblyResolver
DEBUG: Registering default: ScriptCs.Contracts.IAssemblyResolver
DEBUG: Registering default: ScriptCs.Contracts.IInstallationProvider
DEBUG: Registering default: ScriptCs.Contracts.IPackageInstaller
DEBUG: Registering default: ScriptCs.Hosting.IModuleLoader
DEBUG: Registering default: ScriptCs.Contracts.IAppDomainAssemblyResolver
DEBUG: Registering default: ScriptCs.Contracts.IFilePreProcessor
DEBUG: Mapping Assembly Autofac.Integration.Mef to version:3.0.0.0
DEBUG: Mapping Assembly Autofac to version:3.3.0.0
DEBUG: Mapping Assembly Common.Logging to version:2.1.2.0
DEBUG: Mapping Assembly ICSharpCode.NRefactory.CSharp to version:5.0.0.0
DEBUG: Mapping Assembly ICSharpCode.NRefactory to version:5.0.0.0
DEBUG: Mapping Assembly Microsoft.Web.XmlTransform to version:2.1.0.0
DEBUG: Mapping Assembly Mono.CSharp to version:4.0.0.0
DEBUG: Mapping Assembly Mono.Cecil to version:0.9.5.0
DEBUG: Mapping Assembly Newtonsoft.Json to version:6.0.0.0
DEBUG: Mapping Assembly NuGet.Core to version:2.8.60318.667
DEBUG: Mapping Assembly PowerArgs to version:2.0.4.0
DEBUG: Mapping Assembly Roslyn.Compilers.CSharp to version:1.2.0.0
DEBUG: Mapping Assembly Roslyn.Compilers to version:1.2.0.0
DEBUG: Mapping Assembly ScriptCs.Contracts to version:0.14.0.0
DEBUG: Mapping Assembly ScriptCs.Core to version:0.14.0.0
DEBUG: Mapping Assembly ScriptCs.Engine.Mono to version:0.14.0.0
DEBUG: Mapping Assembly ScriptCs.Engine.Roslyn to version:0.14.0.0
DEBUG: Mapping Assembly ScriptCs.Hosting to version:0.14.0.0
DEBUG: Mapping Assembly scriptcs to version:0.14.0.0
DEBUG: Resolving IModuleLoader
DEBUG: Resolving IFileSystem
DEBUG: Only CSharp module is needed - will skip module lookup
DEBUG: Initializing module: System.Reflection.MonoAssembly
DEBUG: Resolving ScriptServices
DEBUG: Registering runtime services
DEBUG: Registering default: ScriptCs.Contracts.IFileSystem
DEBUG: Registering default: ScriptCs.Contracts.IAssemblyUtility
DEBUG: Registering default: ScriptCs.Contracts.IPackageContainer
DEBUG: Registering default: ScriptCs.Contracts.IPackageAssemblyResolver
DEBUG: Registering default: ScriptCs.Contracts.IAssemblyResolver
DEBUG: Registering default: ScriptCs.Contracts.IScriptHostFactory
DEBUG: Registering default: ScriptCs.Contracts.IFilePreProcessor
DEBUG: Registering default: ScriptCs.Contracts.IScriptPackResolver
DEBUG: Registering default: ScriptCs.Contracts.IInstallationProvider
DEBUG: Registering default: ScriptCs.Contracts.IPackageInstaller
DEBUG: Registering default: ScriptCs.ScriptServices
DEBUG: Registering default: ScriptCs.Contracts.IObjectSerializer
DEBUG: Registering default: ScriptCs.Contracts.IConsole
DEBUG: Registering default: ScriptCs.Contracts.IFileSystemMigrator
DEBUG: Registering default: ScriptCs.Contracts.IScriptLibraryComposer
DEBUG: Resolving IAssemblyResolver
Copying directory 'bin' to 'scriptcs_bin'...
Unhandled Exception:
System.UnauthorizedAccessException: Access to the path "scriptcs_bin" is denied.
at System.IO.Directory.CreateDirectoriesInternal (System.String path) [0x00000] in <filename unknown>:0
at System.IO.Directory.CreateDirectory (System.String path) [0x00000] in <filename unknown>:0
at ScriptCs.FileSystem.CopyDirectory (System.String source, System.String dest, Boolean overwrite) [0x00000] in <filename unknown>:0
at ScriptCs.FileSystemMigrator.Migrate () [0x00000] in <filename unknown>:0
at ScriptCs.Command.CommandFactory.CreateCommand (ScriptCs.ScriptCsArgs args, System.String[] scriptArgs) [0x00000] in <filename unknown>:0
at ScriptCs.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.UnauthorizedAccessException: Access to the path "scriptcs_bin" is denied.
at System.IO.Directory.CreateDirectoriesInternal (System.String path) [0x00000] in <filename unknown>:0
at System.IO.Directory.CreateDirectory (System.String path) [0x00000] in <filename unknown>:0
at ScriptCs.FileSystem.CopyDirectory (System.String source, System.String dest, Boolean overwrite) [0x00000] in <filename unknown>:0
at ScriptCs.FileSystemMigrator.Migrate () [0x00000] in <filename unknown>:0
at ScriptCs.Command.CommandFactory.CreateCommand (ScriptCs.ScriptCsArgs args, System.String[] scriptArgs) [0x00000] in <filename unknown>:0
at ScriptCs.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
I've tried to pull the source locally and debug but it blows up in Xamarin Studio with: Could not load type 'ScriptCs.Hosting.InitializationServices' from assembly 'ScriptCs.Hosting, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
Thanks. I was hoping for an indication of the current directory 😢
I wonder if the current directory handling has been changed in a later version of atom. I suspect this 'bin' folder that it is finding is in the current directory of the atom process or something. Is it possible to tell atom to switch the current directory to that of the script it is running?
It also makes me wonder if we're handling things properly inside scriptcs.
@scriptcs/core what's the strategy with the scriptcs filesystem artifacts?
Should they be treated as relative to the script specified in the command
line or relative to the current directory? It seems we are doing the latter.
The odd thing is if I execute scriptcs -script /Users/jonathan/Projects/untitled\ folder/hello.csx from the terminal it executes as expected so I'm not sure what the diff is between that and how Atom Runner executes it
I've got it to run inside Atom with this package once I did a PR. The slight quirk with this is that you need to open Atom via terminal rather that UI so it picks up $PATH. Here's my PR https://github.com/ilyapalkin/atom-script/pull/1
From what I know the MAC OSX environment variables are different for apps launched via spotlight and cli...The apps launched from spotlight don't pick up your current path from the profile..
It also makes me wonder if we're handling things properly inside scriptcs.
@scriptcs/core what's the strategy with the scriptcs filesystem artifacts?
Should they be treated as relative to the script specified in the command
line or relative to the current directory? It seems we are doing the
latter.
On 11:20, Sat, 9 May 2015 Jonathan Channon <notifications@github.com
javascript:_e(%7B%7D,'cvml','notifications@github.com');> wrote:
Yeah I've been looking to find the bin folder too.
Not sure about how to tell it which directory to use [image: 😢]
—
Reply to this email directly or view it on GitHub
<#840 (comment)
.
—
Reply to this email directly or view it on GitHub #840 (comment).
It's been a while since there was any activity on this, but I took a look at it yesterday (5 Aug 2017) and I believe the genesis of the "Unexpected named argument" exception is a problem in PowerArgs running under mono. I'm going to try upgrading the reference to PowerArgs to something more recent and see if that addresses the issue.
Activity
adamralph commentedon Oct 24, 2014
@ashutoshraina thanks for reporting
ashutoshraina commentedon Feb 24, 2015
I think this is fixed now ..are we ok to close ?
adamralph commentedon Feb 24, 2015
@ashutoshraina can you reproduce the error using script 0.13.3? If you can't, then I guess it is indeed closed.
ashutoshraina commentedon Feb 25, 2015
this works with the -script parameter.
We can then provide the full path and it picks it up correctly, I checked the usual things like script packs are also loaded correctly.
adamralph commentedon Feb 25, 2015
@ashutoshraina but it still doesn't work without the script parameter? I.e.
scriptcs "/Users/ashutoshraina/Projects/Scripts/HelloWorld.csx"still throws the error?
ashutoshraina commentedon Feb 25, 2015
still says that the file could not be found.
However,
is fine (notice the lack of quotes).
Again, this fails.
I assumed the script flag was meant for doing this, but may be this should work as well. Reopening this.
adamralph commentedon Feb 25, 2015
Thanks, I'm going to mark it as a P3 since there is a workaround, but yes, I think we should fix this if possible.
5 remaining items
jchannon commentedon May 9, 2015
I've tried to pull the source locally and debug but it blows up in Xamarin Studio with:
Could not load type 'ScriptCs.Hosting.InitializationServices' from assembly 'ScriptCs.Hosting, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.adamralph commentedon May 9, 2015
Thanks. I was hoping for an indication of the current directory 😢
I wonder if the current directory handling has been changed in a later version of atom. I suspect this 'bin' folder that it is finding is in the current directory of the atom process or something. Is it possible to tell atom to switch the current directory to that of the script it is running?
jchannon commentedon May 9, 2015
Yeah I've been looking to find the
binfolder too.Not sure about how to tell it which directory to use 😢
jchannon commentedon May 9, 2015
I just installed this alternative package but although it doesn't fail the script isnt run due to the full path to the script file I suspect.
I also dont like it as you need to put a shebang at the top of the script file
adamralph commentedon May 9, 2015
It also makes me wonder if we're handling things properly inside scriptcs.
@scriptcs/core what's the strategy with the scriptcs filesystem artifacts?
Should they be treated as relative to the script specified in the command
line or relative to the current directory? It seems we are doing the latter.
On 11:20, Sat, 9 May 2015 Jonathan Channon notifications@github.com wrote:
jchannon commentedon May 9, 2015
The odd thing is if I execute
scriptcs -script /Users/jonathan/Projects/untitled\ folder/hello.csxfrom the terminal it executes as expected so I'm not sure what the diff is between that and how Atom Runner executes itjchannon commentedon May 9, 2015
I've got it to run inside Atom with this package once I did a PR. The slight quirk with this is that you need to open Atom via terminal rather that UI so it picks up $PATH. Here's my PR https://github.com/ilyapalkin/atom-script/pull/1
ashutoshraina commentedon May 9, 2015
From what I know the MAC OSX environment variables are different for apps launched via spotlight and cli...The apps launched from spotlight don't pick up your current path from the profile..
paulbouwer commentedon May 9, 2015
I would think they should be relative to the script. The script/s and file
system artefacts should be co-located.
On Saturday, May 9, 2015, Adam Ralph notifications@github.com wrote:
adamralph commentedon May 9, 2015
I agree
marking commentedon Aug 6, 2017
It's been a while since there was any activity on this, but I took a look at it yesterday (5 Aug 2017) and I believe the genesis of the "
Unexpected named argument" exception is a problem in PowerArgs running under mono. I'm going to try upgrading the reference to PowerArgs to something more recent and see if that addresses the issue.happy15 commentedon Dec 13, 2018
0.17.1 installed with brew still encounter the same problem.
is ok, while
complains "Unexpected named argument: tmp/t.csx"
filipw commentedon Dec 13, 2018
correct, the fix has not been released yet, but it's been merged
happy15 commentedon Dec 13, 2018
@filipw , good to know.
any planned date for the release?