Getting compile error on provided type

I'm working on a TypeProvider that reads an XSD file and provides a type for each type defined in the XSD. However I have a problem in the below code

type schema = XmlProviders.Schema<"file.xsd">
type Bazzer = {
    Sum : XmlProviders.bar
}

on the last line I get a compilation error saying that XmlProviders.bar does not exist. The implementation of how I define the types are as follows

let defineType (xType : XElement) =
    let name = xType.Attribute(XName.Get "name").Value
    let t = ProvidedTypeDefinition(thisAssembly,
                                       ns,
                                       name,
                                       baseType = Some typeof<obj>)

    let ctor = ProvidedConstructor(parameters = [ ], 
                                   InvokeCode= (fun args -> <@@ "" :> obj @@>))
    t.AddMember ctor



 do provider.DefineStaticParameters(parameters, fun tyName args ->

    let filename = args.[0] :?> string
    let main = ProvidedTypeDefinition(thisAssembly,ns,
                                       tyName,
                                       baseType = Some typeof<obj>)

    //Elements is a list of XElement
    elements |> List.map defineType |> ignore
    main

I know that a XmlProviders.bar type is created because if I add an additional line to defineType provider.AddMember t then I get an error saying

The type provider 'XmlProviders.SampleTypeProvider' reported an error: container type for 'XmlProviders.bar' was already set to 'XmlProviders.Schema'

Where XmlProviders.Schema is the ProvidedTypeDefinition identified by provider

I'm a bit lost on why the compiler complains that the type is not there while if I explicitly add it I get the error that it's already there

Answers


Found the answer, so to those that end in the same situation

the line

let t = ProvidedTypeDefinition(thisAssembly,
                                   ns,
                                   name,
                                   baseType = Some typeof<obj>)

where the nested type is defined should be without assembly and namespace

let t = ProvidedTypeDefinition(name,baseType = Some typeof<obj>)

Need Your Help

This "really simple" simplexml scrip't isn't working

php xml simplexml

&lt;?xml version="1.0" encoding="ISO-8859-1" ?&gt;

Basic programming/algorithmic concepts

algorithm language-agnostic theory

I'm about to start (with fellow programmers) a programming &amp; algorithms club in my high school. The language of choice is C++ - sorry about that, I can't change this. We can assume students have