
linfu - issue #31
Argument for generic ref parameter nulled out by proxy implementation
What steps will reproduce the problem?
1. Create an interface with a method that takes a generic ref parameter,
e.g.
void SaveOrUpdate<T>(ref T data);
2. Create a proxy for the interface using an implementation of
IInvokeWrapper
3. Call SaveOrUpdate on the proxy with valid data.
4. The constructor for InvocationInfo is called with a null item in the
'arguments' array and hence IInvokeWrapper.DoInvoke implementation
fails.
What is the expected output? What do you see instead?
What version of the product are you using? On what operating system? Rev 419 on Windows Server 2003.
Please provide any additional information below.
Comment #1
Posted on Aug 7, 2009 by Massive Bird(No comment was entered for this change.)
Comment #2
Posted on Aug 9, 2009 by Massive BirdUnfortunately, there isn't any way for LinFu.Proxy to handle ref T arguments since it has to know whether or not type 'T' is going to be a reference type or a value type before it can emit the necessary IL instructions that will let you pass your ref argument down to the interceptor.
A simple workaround for this would be just to stick with a SaveOrUpdate(T target) method and let type T be either a parameter object or a POCO reference type and let the reference type pass the data by reference for you, if necessary. It's an ugly hack, but it should work.
Status: WontFix
Labels:
Type-Defect
Priority-High