{"record":{"id":"eb207b0406e8a504","repo":"microsoft/autogen","slug":"parameter-name-cannot-be-null","errorCode":null,"errorMessage":"Parameter name cannot be null","messagePattern":"Parameter name cannot be null","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"dotnet/src/AutoGen.AzureAIInference/Extension/FunctionContractExtension.cs","lineNumber":34,"sourceCode":"    /// Convert a <see cref=\"FunctionContract\"/> to a <see cref=\"FunctionDefinition\"/> that can be used in gpt funciton call.\n    /// </summary>\n    /// <param name=\"functionContract\">function contract</param>\n    /// <returns><see cref=\"FunctionDefinition\"/></returns>\n    public static FunctionDefinition ToAzureAIInferenceFunctionDefinition(this FunctionContract functionContract)\n    {\n        var functionDefinition = new FunctionDefinition\n        {\n            Name = functionContract.Name,\n            Description = functionContract.Description,\n        };\n        var requiredParameterNames = new List<string>();\n        var propertiesSchemas = new Dictionary<string, JsonSchema>();\n        var propertySchemaBuilder = new JsonSchemaBuilder().Type(SchemaValueType.Object);\n        foreach (var param in functionContract.Parameters ?? [])\n        {\n            if (param.Name is null)\n            {\n                throw new InvalidOperationException(\"Parameter name cannot be null\");\n            }\n\n            var schemaBuilder = new JsonSchemaBuilder().FromType(param.ParameterType ?? throw new ArgumentNullException(nameof(param.ParameterType)));\n            if (param.Description != null)\n            {\n                schemaBuilder = schemaBuilder.Description(param.Description);\n            }\n\n            if (param.IsRequired)\n            {\n                requiredParameterNames.Add(param.Name);\n            }\n\n            var schema = schemaBuilder.Build();\n            propertiesSchemas[param.Name] = schema;\n\n        }\n        propertySchemaBuilder = propertySchemaBuilder.Properties(propertiesSchemas);","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/dotnet/src/AutoGen.AzureAIInference/Extension/FunctionContractExtension.cs#L16-L52","documentation":"Error \"Parameter name cannot be null\" thrown in microsoft/autogen.","triggerScenarios":"Thrown at dotnet/src/AutoGen.AzureAIInference/Extension/FunctionContractExtension.cs:34 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Give every parameter of the function a valid name"],"exampleFix":"Annotate the method parameter with a non-null name","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}