Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid type when using generics and MongoDiscriminated #34

Open
nekresh opened this issue Sep 14, 2010 · 0 comments
Open

Invalid type when using generics and MongoDiscriminated #34

nekresh opened this issue Sep 14, 2010 · 0 comments

Comments

@nekresh
Copy link

nekresh commented Sep 14, 2010

When using the attribute [MongoDiscriminated] on a generic class, the type string return by ReflectionHelper.GetTypeDiscriminator() is truncated and not valid which lead to an exception when using it in Type.GetType().

With the following code :

class Program
{
    [Norm.MongoDiscriminated]
    class Error<T>
    { }

    static void Main(string[] args)
    {
        var helper = new Norm.BSON.ReflectionHelper(typeof(Error<int>));
        Console.WriteLine(helper.GetTypeDiscriminator());
    }
}

I get the following type :
test.norm.Program+Error`1[[System.Int32, mscorlib

When the valid type would have been :
test.norm.Program+Error`1[[System.Int32, mscorlib]], test.norm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant