zzzprojects / EntityFramework-Classic

Entity Framework Classic is a supported version of the latest EF6 codebase. It supports .NET Framework and .NET Core and overcomes some EF limitations by adding tons of must-haves built-in features.
https://entityframework-classic.net
Other
103 stars 27 forks source link

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

Open schuettecarsten opened 4 years ago

schuettecarsten commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

Thank @rmaenk for the answer ;)

It might be exactly the solution.

schuettecarsten commented 4 years ago

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 commented 4 years ago
internal sealed class Configuration : DbMigrationsConfiguration<YourDBContext> {
    static Configuration() {
        Z.EntityFramework.Classic.EntityFrameworkManager.ConfigSectionName = "entityFrameworkClassic";
    }

This did not help, unfortunately.

schuettecarsten commented 4 years ago

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 commented 4 years ago

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 commented 3 years ago

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.