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

Remove hardwired return type in ExecuteScriptCommand #725

Merged
merged 4 commits into from
Jun 5, 2023

Conversation

isaacvale
Copy link
Contributor

ExecuteScriptCommand return type should be generic. This PR removes the hardwired return type, pushes it up to Program.cs and passes generic type.

@filipw
Copy link
Member

filipw commented Jun 5, 2023

thanks - can you explain your use case?

@isaacvale
Copy link
Contributor Author

Sure! I needed to run CSX files directly from .NET runtime, and have a custom object as a return type for further processing.

I found this great post which got me up-and-running in no time. But I found that it doesn't correctly load all assemblies when referencing some nuget packages. For instance Microsoft.Data.SqlClient nuget fails to load "SNI.dll", although it works correctly from CLI.

So I backtraced it, and after the modification in this PR, I ended using the ExecuteScriptCommand directly which works great.

@@ -17,7 +17,7 @@ public PublishCommand(ScriptConsole scriptConsole, LogFactory logFactory)
_logFactory = logFactory;
}

public void Execute(PublishCommandOptions options)
public void Execute<TReturn>(PublishCommandOptions options)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense thanks. It's technically a breaking change - could you please keep the old one too and add the generic as a new overload?

It does not matter that much but I would like to have backwards compatibility in the public API unless we rev up major version

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you're right, should be an overload, backwards compatibility is very important. Sure, I'll add it

Copy link
Member

@filipw filipw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@filipw filipw enabled auto-merge June 5, 2023 18:08
@filipw filipw merged commit cc8e9e7 into dotnet-script:master Jun 5, 2023
3 checks passed
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

Successfully merging this pull request may close these issues.

None yet

3 participants