Bug seting out parameter??

Technical questions about PostSharp Laos.

Bug seting out parameter??

Postby vbandrade on Thu Jul 03, 2008 10:32 pm

Hello there, i´m struggling with the out parameter and what did I find out?

I dont know if it´s a bug or it´s the expected behavior, it looks like an error...

I have an OnMethodBoundaryAspect and in the OnEntry I change the value of the output parameter and set the FlowBehavior to Return. I was expecting to have that value back on my method... but it´s no there.

If I change the out parameter in OnSuccess or OnExit, it works. );

So, whats the deal with out parameter?

Tanks.
vbandrade
 
Posts: 6
Joined: Wed Jul 02, 2008 6:39 am
Last Name: vbandrade

Re: Bug seting out parameter??

Postby gfraiteur on Fri Jul 04, 2008 2:58 pm

What does Reflector say? Did you look at the generated code?
Gael Fraiteur, project leader
gfraiteur
Site Admin
 
Posts: 839
Joined: Tue Dec 18, 2007 3:09 pm
First Name: Gael
Last Name: Fraiteur
Company: postsharp.org

Re: Bug seting out parameter??

Postby vbandrade on Fri Jul 04, 2008 5:47 pm

Hey there,

Reflector says:

private static int Print(int a, out int b)
{
// Cut stuff we dont need.
if (args.FlowBehavior == FlowBehavior.Return)
{
returnValue = (int) args.ReturnValue;
objArray[1] = (int) b;
return returnValue;
}
//back to method

PostSharp is ignoring whatever I do to the out parameter and overrides it with the default value. I dont think that should ever be done.

I'm using PostSharp 1.0.9.373

Thanks.

Edit: Attached my test.
You do not have the required permissions to view the files attached to this post.
vbandrade
 
Posts: 6
Joined: Wed Jul 02, 2008 6:39 am
Last Name: vbandrade

Re: Bug seting out parameter??

Postby gfraiteur on Fri Jul 04, 2008 5:59 pm

It looks like a bug, because PostSharp does:

objArray[1] = (int) b;

but it should do:

b = (int) objArray[1]

Could you report it? Please include a link to the current discussion.

Thanks,

Gael
Gael Fraiteur, project leader
gfraiteur
Site Admin
 
Posts: 839
Joined: Tue Dec 18, 2007 3:09 pm
First Name: Gael
Last Name: Fraiteur
Company: postsharp.org

Re: Bug seting out parameter??

Postby vbandrade on Fri Jul 04, 2008 6:24 pm

It's there:
http://www.postsharp.org/tracker/view.php?id=234

i just started following this project and I'm wondering how long does it take to fix stuff like that. It looks like a simple fix to me.

Then I downloaded the code. Well, not THAT simple, but find my way through...
My guess is that you should solve this in the file OnMethodBoundaryAspectWeaver.cs
lines 349 and 350... but then again, I just got here.

Sorry for wasting your time, it's a awesome tool and since I don't have the money to contribute (specially from Brasil) I was looking for a way to contribute. I better start writing some beginner tutorials.

Congrats on your work
vbandrade
 
Posts: 6
Joined: Wed Jul 02, 2008 6:39 am
Last Name: vbandrade


Return to PostSharp Laos


cron