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

"Cannot bind argument to parameter 'Path' because it is an empty string" when running Add-Migration #52

Open
schuettecarsten opened this issue Mar 31, 2020 · 9 comments
Assignees

Comments

@schuettecarsten
Copy link

When I run “Add-Migration” from the package manager console, I get:

PM> Add-Migration test
Join-Path : Cannot bind argument to parameter 'Path' because it is an empty string.
At D:\Projekte\Azure\CMT\Source\Packages\z.entityframework.classic\7.1.25\tools\EntityFramework.psm1:715 char:28
+     $toolsPath = Join-Path $installPath tools
+                            ~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Join-Path], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand

Join-Path : Cannot bind argument to parameter 'Path' because it is null.
At D:\Projekte\Azure\CMT\Source\Packages\z.entityframework.classic\7.1.25\tools\EntityFramework.psm1:782 char:74
+ ...  [System.Reflection.Assembly]::LoadFrom((Join-Path $ToolsPath EntityF ...
+                                                        ~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Join-Path], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand

You cannot call a method on a null-valued expression.
At D:\Projekte\Azure\CMT\Source\Packages\z.entityframework.classic\7.1.25\tools\EntityFramework.psm1:783 char:5
+     $dispatcher = $utilityAssembly.CreateInstance(
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

Join-Path : Cannot bind argument to parameter 'Path' because it is null.
At D:\Projekte\Azure\CMT\Source\Packages\z.entityframework.classic\7.1.25\tools\EntityFramework.psm1:812 char:20
+         (Join-Path $runner.ToolsPath EntityFramework.PowerShell.dll),
+                    ~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Join-Path], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand

PM>

Please note that in my project, I have moved the DbContext and the Migrations into a separate assembly “CMT.DataAccess” and the Model into an assembly “CMT.DataAccess.Model”. This worked fine for EF6. To migrate from EF6 to EFClassic, I removed all EntityFramework packages and installed the EFClassic packages as described in the documentation.

@JonathanMagnan
Copy link
Member

Hello @schuettecarsten ,

Could you provide your project to make sure we try to debug it with your current setup?

So we will be sure that when the fix will be released, it will work with your model.

You can send it to: info@zzzprojects.com if you need to keep the source private

Best Regards,

Jonathan


 
Performance Libraries
context.BulkInsert(list, options => options.BatchSize = 1000);
Entity Framework ExtensionsEntity Framework ClassicBulk OperationsDapper Plus
 
Runtime Evaluation
Eval.Execute("x + y", new {x = 1, y = 2}); // return 3
C# Eval FunctionSQL Eval Function

@JonathanMagnan
Copy link
Member

Hello @schuettecarsten,

Since our last conversation, we haven't heard from you.

Could you provide a full example of this issue on our email: info@zzzprojects.com

Looking forward to hearing from you,

Jon

@rmaenk
Copy link

rmaenk commented Apr 8, 2020

Hello,
I am not sure about your configuration, but just in case, try to specify ConfigSection for migrations like this:

    internal sealed class Configuration : DbMigrationsConfiguration<YourDBContext> {
        static Configuration() {
            Z.EntityFramework.Classic.EntityFrameworkManager.ConfigSectionName = "entityFrameworkClassic";
        }

If you use default "entityFramework" section - change code above accordingly
Regards,
Roman

@JonathanMagnan
Copy link
Member

Thank @rmaenk for the answer ;)

It might be exactly the solution.

@schuettecarsten
Copy link
Author

I will give it a try, thank you.

Meanwhile I moved back to EF6 with EF+ because there were too many side effects. So, testing this might take some time. I will close this issue,

@schuettecarsten
Copy link
Author

internal sealed class Configuration : DbMigrationsConfiguration<YourDBContext> {
    static Configuration() {
        Z.EntityFramework.Classic.EntityFrameworkManager.ConfigSectionName = "entityFrameworkClassic";
    }

This did not help, unfortunately.

@schuettecarsten
Copy link
Author

Hello @schuettecarsten ,

Could you provide your project to make sure we try to debug it with your current setup?

So we will be sure that when the fix will be released, it will work with your model.

You can send it to: info@zzzprojects.com if you need to keep the source private

I sent you an email some days ago...

@JonathanMagnan
Copy link
Member

Hello @schuettecarsten ,

We are sorry for the delay in our answer.

We have received your email and we are currently looking at the issue.

We will contact you via email.

Best regards,

Jon

@JonathanMagnan
Copy link
Member

Thank you for the project,

We can successfully reproduce it. We will need to review the part of the migration under the .NET Standard.

However, it doesn't look to be a quick job as we will need to sync our repo with the official EF versions.

We currently need first to complete our code re-write for EF Core 5 which is coming soon.

@JonathanMagnan JonathanMagnan self-assigned this Aug 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants