scaffold-dbcontext error with frameworkName as empty string

230 views Asked by At

I'm using a scaffold-dbcontext command that has worked in the past. It's been about a year since I had to use it though.

Scaffold-DBContext 
    -Connection "server=MYSERVER; database=A9000; Integrated Security=true; Trusted_Connection=true; MultipleActiveResultSets=True" 
    -Provider "Microsoft.EntityFrameworkCore.SqlServer" 
    -context "A9000Context" -contextdir "Model/A9000" 
    -outputdir "Model/A9000" 
    -Tables TABLE_1, TABLE_2 
    -NoOnConfiguring -f -Verbose

I'm getting this error

Exception calling ".ctor" with "1" argument(s): The parameter 'frameworkName' cannot be an empty string.
Parameter name: frameworkName

I've been looking at other issues referencing the frameworkName including ef-migrations-the-parameter-frameworkname-cannot-be-an-empty-string but they're all related to add-migration. In my case I'm trying to migrate.

I checked through my code and I can't find a place where I'm using anything called frameworkName. I can't find any constructors that take an argument without passing it to their base. I checked for code that news objects without using the required arguments. Since I'm not trying to migrate anything, I'm not sure what it's trying to construct.

I used $error[0]|fl -force to get this output:

ErrorRecord                 : Exception calling ".ctor" with "1" argument(s): "The parameter 'frameworkName' cannot be an empty string.
                              Parameter name: frameworkName"
WasThrownFromThrowStatement : False
Message                     : Exception calling ".ctor" with "1" argument(s): "The parameter 'frameworkName' cannot be an empty string.
                              Parameter name: frameworkName"
Data                        : {System.Management.Automation.Interpreter.InterpretedFrameInfo}
InnerException              : System.Management.Automation.MethodInvocationException: Exception calling ".ctor" with "1" argument(s): "The parameter 'frameworkName' cannot be an empty string.
                              Parameter name: frameworkName" ---> System.ArgumentException: The parameter 'frameworkName' cannot be an empty string.
                              Parameter name: frameworkName
                                 at System.Runtime.Versioning.FrameworkName..ctor(String frameworkName)
                                 --- End of inner exception stack trace ---
                                 at System.Management.Automation.DotNetAdapter.AuxiliaryConstructorInvoke(MethodInformation methodInformation, Object[] arguments, Object[] originalArguments)
                                 at System.Management.Automation.DotNetAdapter.ConstructorInvokeDotNet(Type type, ConstructorInfo[] constructors, Object[] arguments)
                                 at Microsoft.PowerShell.Commands.NewObjectCommand.CallConstructor(Type type, ConstructorInfo[] constructors, Object[] args)
TargetSite                  : Void CheckActionPreference(System.Management.Automation.Language.FunctionContext, System.Exception)
StackTrace                  :    at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
                                 at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
                                 at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
                                 at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
                                 at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)
                                 at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
                                 at System.Management.Automation.DlrScriptCommandProcessor.RunClause(Action`1 clause, Object dollarUnderbar, Object inputToProcess)
                              --- End of stack trace from previous location where exception was thrown ---
                                 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
                                 at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input)
                                 at System.Management.Automation.Runspaces.LocalPipeline.InvokeHelper()
                                 at System.Management.Automation.Runspaces.LocalPipeline.InvokeThreadProc()
HelpLink                    : 
Source                      : System.Management.Automation
HResult                     : -2146233087

I haven't ever dug into the operations in scaffold-dbcontext before... it just worked. So I have no idea about what it's doing at this point.

Can someone help me find the place where frameworkName is used and what needs to be fixed?

TIA, Mike

0

There are 0 answers