-
Notifications
You must be signed in to change notification settings - Fork 369
Only use fast path when extension is CSX or none #980
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
Conversation
src/ScriptCs.Hosting/ModuleLoader.cs
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we make the comparison with ".csx" case insensitive?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point
On 21 March 2015 at 21:48, Adam Ralph notifications@github.com wrote:
In src/ScriptCs.Hosting/ModuleLoader.cs
#980 (comment):@@ -69,7 +71,8 @@ public ModuleLoader(IAssemblyResolver resolver, ILog logger, Action<Assembly, Ag
{
if (modulePackagesPaths == null) return;
if (moduleNames.Length == 1 && DefaultCSharpModules.ContainsKey(moduleNames[0])) // only CSharp module needed// only CSharp module needed - use fast pathif (moduleNames.Length == 1 && DefaultCSharpModules.ContainsKey(moduleNames[0]) && (extension == DefaultCSharpExtension || string.IsNullOrWhiteSpace(extension)))Should we make the comparison with ".csx" case insensitive?
—
Reply to this email directly or view it on GitHub
https://github.com/scriptcs/scriptcs/pull/980/files#r26896677.
|
Whilst we're here, should we also instantiate internal static readonly Dictionary<string, string> DefaultCSharpModules =
new Dictionary<string, string>(StringComparer.CurrentCultureIgnoreCase)
{
{"roslyn", "ScriptCs.Engine.Roslyn.dll"},
{"mono", "ScriptCs.Engine.Mono.dll"}
}; |
src/ScriptCs.Hosting/ModuleLoader.cs
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This blows up with a NullReferenceException if extension is null (REPL). You'll have to use string.Equals(extension, DefaultCSharpExtension, StringComparison.OrdinalIgnoreCase)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or you could swap the order of the conditions around the ||, but may as well just call the static on string.
|
The Travis build is still so flaky... IIRC I've seen the problem before. It's a race condition in xunit 1.0. I don't know why it only manifests in Linux though. |
|
LGTM. The module name casing can be left for now, that's a wider problem which isn't catered for in |
Only use fast path when extension is CSX or none
Fixes #964 and unblocks 0.14 release
The fast path is only invoked if there is: