ltrzesniewski / InlineIL.Fody

Inject arbitrary IL code at compile time.
MIT License
240 stars 17 forks source link

Better discoverability of IL.Push/IL.Pop #3

Closed Rohansi closed 6 years ago

Rohansi commented 6 years ago

DeclareLocals is really useful to have but it'd also be nice to reference normal C# locals too. I just noticed there's also Push and Pop so maybe the error could point to those, but maybe the names can be changed to Load and Store to match IL opcode names more?

ltrzesniewski commented 6 years ago

Yes, Push and Pop are there for this purpose. I guess they could have been named Load and Store but I'm reluctant to take a breaking change just for renaming them right now.

I see no other way to reference normal C# locals, because they can get optimized out in release builds, and there's no way to map C# local names to IL locals.

Can you tell me which error message you got, so I can improve it?

Rohansi commented 6 years ago

Oh right, I forgot they would be optimized out.

I don't have the exact error message but I believe it was number 0002 and it suggested to use DeclareLocals. That hint could be expanded to include Push and Pop in case a user is trying to access a C# local.

On Jul 22, 2018 8:08 AM, Lucas Trzesniewski notifications@github.com wrote:

Yes, Push and Pop are there for this purpose. I guess they could have been named Load and Store but I'm reluctant to take a breaking change just for renaming them right now.

I see no other way to reference normal C# locals, because they can get optimized out in release builds, and there's no way to map C# local names to IL locals.

Can you tell me which error message you got, so I can improve it?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/ltrzesniewski/InlineIL.Fody/issues/3#issuecomment-406861861, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ABQjzPs3sNCN1hGRmREpAGiFLDcRebTYks5uJGtMgaJpZM4VZ-FK.