NullReferenceException while generating Data Contract

Jun 10, 2010 at 2:04 PM

Hi,

I tried to generate some Data Contract Code and received this:

6-10-2010 14:58
Entering QueryStatus method.

6-10-2010 14:58
Leaving QueryStatus method.

6-10-2010 14:58
Entering QueryStatus method.

6-10-2010 14:58
Generate code command is enabled

6-10-2010 14:58
Leaving QueryStatus method.

6-10-2010 14:58
Entering QueryStatus method.

6-10-2010 14:58
WSCF context menu is enabled.

6-10-2010 14:58
Leaving QueryStatus method.

6-10-2010 14:58
Entering QueryStatus method.

6-10-2010 14:58
Edit WSDL command is enabled.

6-10-2010 14:58
Leaving QueryStatus method.

6-10-2010 14:58
Entering QueryStatus method.

6-10-2010 14:58
Generate code command is enabled

6-10-2010 14:58
Leaving QueryStatus method.

6-10-2010 14:58
Entering QueryStatus method.

6-10-2010 14:58
Generate code command is enabled

6-10-2010 14:58
Leaving QueryStatus method.

6-10-2010 14:58
Entering QueryStatus method.

6-10-2010 14:58
Generate code command is enabled

6-10-2010 14:58
Leaving QueryStatus method.

6-10-2010 14:58
Entering QueryStatus method.

6-10-2010 14:58
WSCF context menu is enabled.

6-10-2010 14:58
Leaving QueryStatus method.

6-10-2010 14:58
Entering QueryStatus method.

6-10-2010 14:58
WSCF context menu is enabled.

6-10-2010 14:58
Leaving QueryStatus method.

6-10-2010 14:58
Entering QueryStatus method.

6-10-2010 14:58
WSCF context menu is enabled.

6-10-2010 14:58
Leaving QueryStatus method.

6-10-2010 14:58
Entering QueryStatus method.

6-10-2010 14:58
Edit WSDL command is enabled.

6-10-2010 14:58
Leaving QueryStatus method.

6-10-2010 14:58
Entering QueryStatus method.

6-10-2010 14:58
Edit WSDL command is enabled.

6-10-2010 14:58
Leaving QueryStatus method.

6-10-2010 14:58
Entering QueryStatus method.

6-10-2010 14:58
Edit WSDL command is enabled.

6-10-2010 14:58
Leaving QueryStatus method.

6-10-2010 14:58
Entering QueryStatus method.

6-10-2010 14:58
Generate code command is enabled

6-10-2010 14:58
Leaving QueryStatus method.

6-10-2010 14:58
Entering QueryStatus method.

6-10-2010 14:58
Generate code command is enabled

6-10-2010 14:58
Leaving QueryStatus method.

6-10-2010 14:58
Entering QueryStatus method.

6-10-2010 14:58
Generate code command is enabled

6-10-2010 14:58
Leaving QueryStatus method.

6-10-2010 14:58
Entering Exec method.

6-10-2010 14:58
System.NullReferenceException: Object reference not set to an instance of an object.
   at System.Data.SqlTypes.SqlTypesSchemaImporterExtensionHelper.ImportSchemaType(XmlSchemaType type, XmlSchemaObject context, XmlSchemas schemas, XmlSchemaImporter importer, CodeCompileUnit compileUnit, CodeNamespace mainNamespace, CodeGenerationOptions options, CodeDomProvider codeProvider)
   at System.Xml.Serialization.XmlSchemaImporter.FindExtendedType(XmlSchemaType type, XmlSchemaObject context, CodeCompileUnit compileUnit, CodeNamespace mainNamespace, SchemaImporterExtension& extension)
   at System.Xml.Serialization.XmlSchemaImporter.RunSchemaExtensions(TypeMapping mapping, XmlQualifiedName qname, XmlSchemaType type, XmlSchemaObject context, TypeFlags flags)
   at System.Xml.Serialization.XmlSchemaImporter.ImportElementType(XmlSchemaElement element, String identifier, Type desiredMappingType, Type baseType, String ns)
   at System.Xml.Serialization.XmlSchemaImporter.ImportElement(XmlSchemaElement element, String identifier, Type desiredMappingType, Type baseType, String ns, Boolean topLevelElement)
   at System.Xml.Serialization.XmlSchemaImporter.ImportElementMember(XmlSchemaElement element, String identifier, CodeIdentifiers members, CodeIdentifiers membersScope, INameScope elementsScope, String ns, Boolean repeats, Boolean& needExplicitOrder, Boolean allowDuplicates, Boolean allowUnboundedElements)
   at System.Xml.Serialization.XmlSchemaImporter.ImportGroupMembers(XmlSchemaParticle particle, String identifier, CodeIdentifiers members, CodeIdentifiers membersScope, INameScope elementsScope, String ns, Boolean groupRepeats, Boolean& mixed, Boolean& needExplicitOrder, Boolean allowDuplicates, Boolean allowUnboundedElements)
   at System.Xml.Serialization.XmlSchemaImporter.ImportGroup(XmlSchemaGroupBase group, String identifier, CodeIdentifiers members, CodeIdentifiers membersScope, INameScope elementsScope, String ns, Boolean mixed, Boolean& needExplicitOrder, Boolean allowDuplicates, Boolean groupRepeats, Boolean allowUnboundedElements)
   at System.Xml.Serialization.XmlSchemaImporter.ImportTypeMembers(XmlSchemaType type, String typeNs, String identifier, CodeIdentifiers members, CodeIdentifiers membersScope, INameScope elementsScope, Boolean& needExplicitOrder, Boolean order, Boolean allowUnboundedElements)
   at System.Xml.Serialization.XmlSchemaImporter.ImportStructType(XmlSchemaType type, String typeNs, String identifier, Type baseType, Boolean arrayLike)
   at System.Xml.Serialization.XmlSchemaImporter.ImportType(XmlSchemaComplexType type, String typeNs, String identifier, Type desiredMappingType, Type baseType, TypeFlags flags)
   at System.Xml.Serialization.XmlSchemaImporter.ImportElementType(XmlSchemaElement element, String identifier, Type desiredMappingType, Type baseType, String ns)
   at System.Xml.Serialization.XmlSchemaImporter.ImportElement(XmlSchemaElement element, String identifier, Type desiredMappingType, Type baseType, String ns, Boolean topLevelElement)
   at System.Xml.Serialization.XmlSchemaImporter.ImportElement(XmlQualifiedName name, Type desiredMappingType, Type baseType)
   at System.Xml.Serialization.XmlSchemaImporter.ImportDerivedTypeMapping(XmlQualifiedName name, Type baseType, Boolean baseTypeCanBeIndirect)
   at System.Xml.Serialization.XmlSchemaImporter.ImportTypeMapping(XmlQualifiedName name)
   at Thinktecture.Tools.Web.Services.CodeGeneration.DataContractGenerator.GenerateCode()
   at Thinktecture.Tools.Web.Services.CodeGeneration.CodeGenerator.GenerateCode(CodeGenerationOptions options)
   at Thinktecture.Tools.Web.Services.ContractFirst.Connect.ProcessXsdCodeGenerationRequest()

Kind regards,

MMartin

Jun 11, 2010 at 7:03 PM

Mmartin, What WSDL is this? was it generated from a SQL webservice ?

the logs show some SQL type in the SchemaImporterExtensionHelper.. Any chance you can send us your WSDL?

cheers,

benjy

Jun 16, 2010 at 8:26 AM
Edited Jun 16, 2010 at 11:13 AM

--- had to remove/edit this entry since I replied via Email

>Any chance you can send us your WSDL?

yes, just give me your email address ;-)

May 24, 2013 at 2:23 PM
Was there a solution to this?

I am also getting nullexception then some error with sqltype for apparently no reason.
The xsd and wsdl verify in XML spy etc..