orleans icon indicating copy to clipboard operation
orleans copied to clipboard

Could not find a copier for type <>z__ReadOnlyArray`1[IFoo].

Open Jens-G opened this issue 1 year ago • 3 comments

Using Orleans 8 I got this error message above

Could not find a copier for type <>z__ReadOnlyArray`1[IFoo].

at a rather simple call

await bar.AddFoo([this]);

Both bar and foo (this) are grains. I learned that the z__ReadOnlyArray type is Roslyn generated for array literals, which unfortunately seems to imply that I can't do

[assembly: GenerateCodeForDeclaringAssembly(typeof(z__ReadOnlyArray))]

as recommended elsewhere (or maybe I'm just doing it wrongly).

Jens-G avatar May 30 '24 22:05 Jens-G

Thanks for reporting, @Jens-G! This should work if the parameter type of AddFoo is a concrete type, like List<T>. What is the signature of AddFoo in your example? Either way, I agree that we should implement support for this in-box

ReubenBond avatar May 30 '24 22:05 ReubenBond

Yes, this works around the issue:

var tmp = new List<IFoo>() { this };
await bar.AddFoo(tmp);

The signature I use is this

Task AddFoo(IEnumerable<IFoo> list);

Jens-G avatar May 30 '24 23:05 Jens-G

Also see #8934 and #8964

cptjazz avatar Jun 03 '24 20:06 cptjazz