MassTransit / GreenPipes

An asynchronous pipe implementation for the Task Parallel Library
Apache License 2.0
46 stars 15 forks source link

TypeCache: StackOverflowException if class has property of same type as class itself #12

Open ushenkodmitry opened 5 years ago

ushenkodmitry commented 5 years ago

Hey, attempt to initialize proxy object of the class, that has a property of same type as class itself causes a StackOverflowException to be thrown. For example initialization of proxy class for ExceptionInfo interface (from MassTransit) throws:


var exception = TypeCache<ExceptionInfo>.InitializeFromObject(new {});
phatboyg commented 5 years ago

So, this works with the new message initializers in MassTransit, and it's likely that the capability in GreenPipes will be removed in favor of the new initializer style.

ushenkodmitry commented 5 years ago

Do you want to drop TypeCache<> from GreenPipes entirely? Or just leave it as it is?

phatboyg commented 5 years ago

I haven't really thought about it, but I doubt it. I'll likely just get rid of the mapping logic and replace it with the initializer code.

ushenkodmitry commented 5 years ago

Just want to say that GreenPipes is awesome lib, i'm using it on several projects. Some my code tight to TypeCache API (don't know if it was good idea to tight to API from the internals namespace, but...). So i'm voting for leaving TypeCache API in GreenPipes in some form.

phatboyg commented 5 years ago

Good to know, and yes, it will stay in GreenPipes. I've thought about moving it out to a separate library, but then it's just one more assembly to manage...