Repository navigation
Conversation
0x5bfa
left a comment
There was a problem hiding this comment.
ContextMenu will retire in favor of my new group of helper tho.
| { | ||
| fixed (byte* p = global::System.Text.Encoding.UTF8.GetBytes(value)) | ||
| { | ||
| return new PCSTR(p); |
There was a problem hiding this comment.
I have no idea what you doing. Once getting out of fixed, the p won't be guaranteed to be fixed any longer.
There was a problem hiding this comment.
How do I then construct the struct from a string/int value?
There was a problem hiding this comment.
You have to pin the address until the method you want to call is returned.
fixed (char* pName = name)
{
// PInvoke.Method(..., pName, ...);
}
So, this case you can't create a helper like that.
|
|
||
| public static unsafe PCSTR FromInt(int value) | ||
| { | ||
| return new PCSTR((byte*)&value); |
There was a problem hiding this comment.
Here too, taking pointer of an int value? For what.
Will it not reuse the code here? |
|
I don't think so, I'll create a static ContextMenuManager along with JumpListManager, TrayIconManager, etc, all of which are AoT-safe. That said, I don't think I'd be against this PR as far as this works and because I don't think mine will be implemented any time soon. |
42c8207 to
4c7493f
Compare
Resolved / Related Issues
Steps used to test these changes
WIP