Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add System.Messaging sources #141

Merged
merged 1 commit into from Jul 14, 2020
Merged

Conversation

@karelz
Copy link
Member

@karelz karelz commented Jun 22, 2020

Code for System.Messaging

@karelz
Copy link
Member Author

@karelz karelz commented Jun 22, 2020

@terrajobst can you please merge it?
cc @HongGit @HeathAr @dasetser

internal sealed class SecurityContextHandle : SafeHandleZeroOrMinusOneIsInvalid
{

internal SecurityContextHandle(IntPtr existingHandle)

This comment has been minimized.

@KalleOlaviNiemitalo

KalleOlaviNiemitalo Jun 22, 2020

A note to anyone intending to reuse this code.

System.Messaging.MessageQueue.GetSecurityContext() always throws MissingMethodException because SecurityContextHandle lacks a parameterless (perhaps private) constructor that Platform Invoke would call here:

// This call is here because we don't want to invent a separate MessageQueuePermission
// for this call, and there's no suitable existing permission.
[DllImport(ExternDll.Mqrt, EntryPoint = "MQGetSecurityContextEx", CharSet = CharSet.Unicode)]
private static extern int IntMQGetSecurityContextEx(IntPtr lpCertBuffer, int dwCertBufferLength, out SecurityContextHandle phSecurityContext);
public static int MQGetSecurityContextEx(out SecurityContextHandle securityContext)
{
try
{
return IntMQGetSecurityContextEx(IntPtr.Zero, 0, out securityContext);
}
catch (DllNotFoundException)
{
throw new InvalidOperationException(Res.GetString(Res.MSMQNotInstalled));
}
}

I don't expect the bug to be fixed in .NET Framework (reported to connect.microsoft.com in 2010) or in Reference Source, but perhaps it can be fixed in the .NET Core port.

@karelz
Copy link
Member Author

@karelz karelz commented Jun 25, 2020

@terrajobst can we merge it please?
cc @danmosemsft

@danmoseley
Copy link
Member

@danmoseley danmoseley commented Jun 25, 2020

@karelz is there a code owner that can sign off here, for the sake of process?

I have merge powers and can do that.

@danmoseley
Copy link
Member

@danmoseley danmoseley commented Jun 25, 2020

Can we also tag the person who originally requested this, so they can confirm everything's here?

@weloytty
Copy link

@weloytty weloytty commented Jun 27, 2020

Can we also tag the person who originally requested this, so they can confirm everything's here?

@danmosemsft I am not sure if you mean someone internal to MSFT, but I am the one who sent the original email after @karelz asked me to in dotnet/runtime#16409 (comment) , and everything I need is in the commit.

@karelz
Copy link
Member Author

@karelz karelz commented Jun 28, 2020

@danmosemsft code owners in .NET Framework are tagged above: #141 (comment)

@danmoseley
Copy link
Member

@danmoseley danmoseley commented Jun 29, 2020

OK - @HongGit @HeathAr @dasetser could one of you please sign off?

@danmoseley danmoseley merged commit a48449c into microsoft:master Jul 14, 2020
1 check passed
1 check passed
license/cla All CLA requirements met.
Details
@danmoseley
Copy link
Member

@danmoseley danmoseley commented Jul 14, 2020

Done! Hope this is what you need @weloytty and apologies for the time it took.

@weloytty
Copy link

@weloytty weloytty commented Jul 14, 2020

Thanks everyone for all of your help, I built everything and made the repo public, and just submitted to nuget a few minutes ago. This was a huge roadblock for us, I'm glad that we won't be stuck on .NET Framework forever.

@danmoseley
Copy link
Member

@danmoseley danmoseley commented Jul 14, 2020

Nice! cc @mconnew fyi.

@mconnew
Copy link
Member

@mconnew mconnew commented Jul 15, 2020

There's going to be some features in this which are broken. For example, you can use transactions with MSMQ but the implementation of System.Transactions in .NET Core doesn't work with MSDTC so that part of System.Messaging won't work. I'm not super familiar with the code base or even api so I'm not volunteering, but someone should go through the features supported by the api and work out what does and doesn't work and throw PlatformNotSupportedException on things which don't work instead of having everyone who consumes this api try and work out why their app isn't working as expected.
Nevermind, just saw this is making the code available in reference source. I thought this was in dotnet/runtime

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

6 participants