Home > Net >  The.net core3.1 compiler has warned
The.net core3.1 compiler has warned

Time:11-20

/Users/pan/Documents/dotNetCore/panCMS/code_core/panCMS/panCMS Web/CSC: Warning AD0001: Analyzer 'Microsoft. AspNetCore. Mvc. Analyzers. TopLevelParameterNameAnalyzer' threw an exception of type 'System. NullReferenceException' with message 'Object reference not set to an instance of an Object'. (AD0001) (panCMS. Web)


Public ResultModel order_add ([FromForm] IFormCollection forms)
{
Var model=new model. The orders ();

Return Utils. GetResult (0, "save error occurs during the process of");
}
Just a way to have this warning, how to deal with this warning,
Should be compiled at fault, don't affect the operation of the program, the program is running normal

CodePudding user response:

Var model=new model. The orders ();
Change
Var model=new List (a);

Or
The orders of Model
List< instead; Order> The orders=new List (a);

CodePudding user response:

In simple terms, is your Model initialization, but his orders not initialized,
We may quote empty abnormalities,
  •  Tags:  
  • C#
  • Related