[Mono-bugs] [Bug 81370][Nor] New - some LP(C)WSTR marshal weirdness on win32

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Fri Apr 13 08:21:10 EDT 2007


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by atsushi at ximian.com.

http://bugzilla.ximian.com/show_bug.cgi?id=81370

--- shadow/81370	2007-04-13 08:21:10.000000000 -0400
+++ shadow/81370.tmp.28139	2007-04-13 08:21:10.000000000 -0400
@@ -0,0 +1,74 @@
+Bug#: 81370
+Product: Mono: Runtime
+Version: 1.0
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: interop
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: atsushi at ximian.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: some LP(C)WSTR marshal weirdness on win32
+
+During cardspace work I'm getting a weird error which seems to be caused by
+marshalling behavioral difference.
+
+Unfortunately this test depends on .NET 3.0 (infocardapi.dll) and thus it
+is reproducible only on windows...
+
+I have a structure that looks like:
+
+	[StructLayout (LayoutKind.Sequential, CharSet = CharSet.Unicode)]
+	struct NativePolicyElement
+	{
+		string target;
+		string issuer;
+		string parameters;
+		string privacy_link;
+		int privacy_ver;
+		bool is_managed;
+	}
+
+and a P/Invoke method:
+
+	[DllImport ("infocardapi", CharSet = CharSet.Unicode)]
+	static extern int GetToken (int cPolicyChain,
+		NativePolicyElement [] pPolicyChain,
+		out NativeGenericXmlToken securityToken,
+		out NativeInfocardCryptoHandle phProofTokenCrypto);
+
+When I compiled the attached repro with gmcs, and run under .NET, it raises
+Infocard selector without errors. When I run the same binary with mono
+(win32 runtime), it raises an error saying:
+
+	"Incoming policy failed validation."
+
+It files an application error on win32 EventLog:
+
+<blockquote>
+Incoming policy failed validation.  Received policy with invalid epr.
+
+Inner Exception: The data at the root level is invalid. Line 1, position 1.
+
+
+Additional Information:
+Microsoft.InfoCards.PolicyValidationException: Received policy with invalid
+epr. ---> System.Xml.XmlException: The data at the root level is invalid.
+Line 1, position 1.
+...
+</blockquote>
+
+(note that there is no invalid XML; .NET runs it just fine).
+
+The error message above refers to "invalid epr", which corresponds to the
+"target" field in NativePolicyElement.
+
+Other parameters such as those "out" ones are ignorable (they will cause an
+error only after you selected a card) and they can be removed to reproduce
+the issue above.


More information about the mono-bugs mailing list