Commit Graph
145 Commits
Author SHA1 Message Date
Miguel de Icaza 2b35d60a5a 2010-04-02 Miguel de Icaza <[email protected]>
* SafeHandle.cs: Use refcount == -1 to indicate that the handle
        had been closed.

        The problem here is that we have no records of why the code that
        threw a ObjectDisposedException inside the do { } while block on
        DangerousAddRef was added.   It seems it was added in response to
        Close() methods being called and the need to throw that exception
        on further calls to ObjectDisposedException.

        Sadly, we have no test suites for that.


svn path=/trunk/mcs/; revision=154741
2010-04-02 21:49:40 +00:00
Jb Evain 05a5b21fa0 use MOONLIGHT symbol
svn path=/trunk/mcs/; revision=153656
2010-03-16 12:10:19 +00:00
Miguel de Icaza 65899ab05b 2009-12-13 Miguel de Icaza <[email protected]>
* SafeBuffer.cs: When comparing the end, we only need to compare
	source+size being bigger than last_byte, not bigger or equal,
	otherwise we can not access the last element.

svn path=/trunk/mcs/; revision=148365
2009-12-14 04:07:47 +00:00
Miguel de Icaza bddf1b1dba 2009-11-08 Miguel de Icaza <[email protected]>
* Marshal.cs: Expose copy_*_unamnaged to SafeBuffer.

	* SafeBuffer.cs: Update SafeBufer implementation

svn path=/trunk/mcs/; revision=145670
2009-11-08 18:04:58 +00:00
Miguel de Icaza 141bcfb930 Jumbo NET_2_0 removal
svn path=/trunk/mcs/; revision=145235
2009-11-03 01:07:23 +00:00
Sebastien Pouliot c2b792aa48 In System.Runtime.InteropServices:
2009-10-15  Sebastien Pouliot  <[email protected]>

	* GCHandle.cs: Add missing validations

In Test/System.Runtime.InteropServices:
2009-10-15  Sebastien Pouliot  <[email protected]>

	* GCHandleTest.cs: Add more test cases for validations


svn path=/trunk/mcs/; revision=144204
2009-10-15 14:20:03 +00:00
Sebastien Pouliot e2572fab1e 2009-09-22 Sebastien Pouliot <[email protected]>
* _Assembly.cs: Remove Evidence and GlobalAssemblyCache 
	properties for NET_2_1
	* Marshal.cs: Avoid depending on SecureString for NET_2_1


svn path=/trunk/mcs/; revision=142398
2009-09-22 13:35:47 +00:00
Sebastien Pouliot 9ced5e4815 2009-09-20 Sebastien Pouliot <[email protected]>
* MarshalAsAttribute.cs: Remove VarEnum field for NET_2_1


svn path=/trunk/mcs/; revision=142276
2009-09-20 15:58:24 +00:00
Sebastien Pouliot 0ee6194428 In .:
2009-09-19  Sebastien Pouliot  <[email protected]>

	* net_2_1_bootstrap_corlib.dll.sources, net_2_1_raw_corlib.dll.sources:
	New. Moonlight specific build files to minimize size and build time.
	Copied from corlib.dll.sources minus some 4.0 stuff and COM types.

In System.Runtime.InteropServices:
2009-09-19  Sebastien Pouliot  <[email protected]>

	* Marshal.cs: Avoid depending on COM stuff for NET_2_1


svn path=/trunk/mcs/; revision=142266
2009-09-19 23:29:17 +00:00
Zoltan Varga 13de10e2f0 2009-09-04 Zoltan Varga <[email protected]>
* SafeBuffer.cs: Mark specific methods as non-cls compliant instead of
	the whole class.

svn path=/trunk/mcs/; revision=141372
2009-09-04 21:49:51 +00:00
Zoltan Varga e1fe3ded9a 2009-09-04 Zoltan Varga <[email protected]>
* SafeBuffer.cs: New net 4.0 class.

svn path=/trunk/mcs/; revision=141368
2009-09-04 21:28:17 +00:00
Jonathan Chambers 11e576a69f Apply patch from Tom Hindle for bug 496138 plus test case.
2009-04-29 Tom Hindle <[email protected]>

	* Marshal.cs: Improved GetExceptionForHR to return real 
	C# exceptions in certain cases instead of always COMException.


svn path=/trunk/mcs/; revision=133150
2009-04-30 01:40:52 +00:00
Marek Habersack fe15b22c9e Revert r130049
svn path=/trunk/mcs/; revision=130110
2009-03-24 08:48:23 +00:00
Marek Habersack 82bbdb387b 2009-03-23 Marek Habersack <[email protected]>
* ConsoleTest.cs: added a bunch of tests for the standard input,
	output and error stream properties.

2009-03-23  Marek Habersack  <[email protected]>

	* FileStreamTest.cs: added a bunch of tests for SafeFileHandle
	constructors

2009-03-23  Marek Habersack  <[email protected]>

	* Console.cs: OpenStandard{Input,Output,Error} no longer use
	FileStream on 2.0+. The reason is that SafeFileHandle used in the
	stream doesn't allow handles with values <= 0, and on Unix stdin
	is 0 which would break the Console class. Instead of FileStream,
	introduced a simple internal specialized stream which is used in
	this scenario.

2009-03-23  Marek Habersack  <[email protected]>

	* FileStream.cs: implemented full support for SafeFileHandle in
	2.0. The obsolete constructors taking an IntPtr now wrap it in a
	SafeFileHandle.

2009-03-23  Marek Habersack  <[email protected]>

	* SafeHandle.cs: added an internal property, OwnsHandle, used by
	FileStream.

svn path=/trunk/mcs/; revision=130049
2009-03-23 12:57:04 +00:00
Miguel de Icaza f7b7dfb893 2009-02-24 Sebastien Pouliot <[email protected]>
* SafeHandle.cs: Add default ctor in 2.1 profile (needed to compile

svn path=/trunk/mcs/; revision=128810
2009-03-06 23:32:09 +00:00
Sebastien Pouliot 13e2f8da3f 2009-02-24 Sebastien Pouliot <[email protected]>
* SafeHandle.cs: Add default ctor in 2.1 profile (needed to compile
	new unit tests in moonlight).


svn path=/trunk/mcs/; revision=127861
2009-02-24 13:19:52 +00:00
Gert Driesen 432be70324 * MarshalTest.cs: Added tests for GetHINSTANCE. Improved existing
tests, and removed use of ExpectedException. Use more meaningful names
for test methods. Minor code formatting.
* Marshal.cs: Fixed order of arguments for ArgumentException in
GetComSlotForMethodInfo.

svn path=/trunk/mcs/; revision=106354
2008-06-21 15:16:06 +00:00
Kornél Pál 7f233567b0 Implement Marshal.GetHINSTANCE.
svn path=/trunk/mcs/; revision=106185
2008-06-19 07:29:53 +00:00
Andreas N 5d52cf552c 2008-04-02 Andreas Nahr <[email protected]>
* _EventInfo.cs
	* _FieldInfo.cs
 	* _MemberInfo.cs
	* _MethodBase.cs
	* _MethodInfo.cs
	* _PropertyInfo.cs
	* _Type.cs
	* ArrayWithOffset.cs
	* BestFitMappingAttribute.cs
	* Marshal.cs: Fix parameter names

svn path=/trunk/mcs/; revision=99654
2008-04-02 17:09:39 +00:00
Zoltan Varga 6f0903abc0 2008-02-20 Zoltan Varga <[email protected]>
* Marshal.cs (GetDelegateForFunctionPointer): Add a nullref check.

svn path=/trunk/mcs/; revision=96274
2008-02-20 17:21:42 +00:00
Sebastien Pouliot 3859376b7f 2008-02-03 Sebastien Pouliot <[email protected]>
* COMException.cs: Fix new-line literal and use of "" detected by
	Gendarme.


svn path=/trunk/mcs/; revision=94693
2008-02-03 15:10:10 +00:00
Gert Driesen 6ad343a846 * COMException.cs: Added missing colon in ToString.
svn path=/trunk/mcs/; revision=92808
2008-01-13 17:24:39 +00:00
Gert Driesen f530096640 * corlib_test.dll.sources: added ExternalExceptionTest.cs.
* ExternalException.cs: Set HResult to match MS.
* ExternalExceptionTest.cs: Added ctor tests.

svn path=/trunk/mcs/; revision=90631
2007-12-04 10:38:09 +00:00
Sebastien Pouliot 33025a0174 2007-11-05 Sebastien Pouliot <[email protected]>
* ComVisible.cs: Fix parameter name (part of #322850).


svn path=/trunk/mcs/; revision=88886
2007-11-05 16:39:05 +00:00
Zoltan Varga 50b7bec28c 2007-09-14 Zoltan Varga <[email protected]>
* GCHandle.cs (AddrOfPinnedObject): Use -2 to communicate that the handle is not
	pinned. Correct exception message. Fixes #82848.

svn path=/trunk/mcs/; revision=85803
2007-09-14 14:40:30 +00:00
Atsushi Eno 56c9656fd4 another set of cosmetic 2.0 API fixes.
svn path=/trunk/mcs/; revision=83679
2007-08-08 16:25:59 +00:00
Miguel de Icaza 9c8e7cd0c7 2007-07-18 Miguel de Icaza <[email protected]>
* SafeHandle.cs: Harden this, do not call ReleaseHandle if the
	handle is invalid.

	* CriticalHandle.cs: Harden this, do not call ReleaseHandle if the
	handle is invalid. 



svn path=/trunk/mcs/; revision=82260
2007-07-19 00:20:40 +00:00
Jonathan Chambers 9fa11ca21f 2007-07-06 Jonathan Chambers <[email protected]>
* ExtensibleClassFactory.cs: Fix ExtensibleClassFactory.
	* __ComObject.cs: Support ExtensibleClassFactory.

svn path=/trunk/mcs/; revision=81494
2007-07-06 16:44:09 +00:00
Jonathan Chambers 6b96d5a052 2007-06-22 Jonathan Chambers <[email protected]>
* __ComObject.cs: Move interface lookup to unmanaged.

2007-06-22  Jonathan Chambers  <[email protected]>

	* __ComObject.cs (ThrowExceptionForHR): Implement/consolidate.
	* __ComObject.cs (GetExceptionForHR): Implement/consolidate.


svn path=/trunk/mcs/; revision=80567
2007-06-22 18:45:29 +00:00
Jonathan Chambers 38abb1c3fd 2007-05-11 Jonathan Chambers <[email protected]>
* Marshal.cs (SecureStringToBSTR): BSTR header is size in bytes,
	not string length.


svn path=/trunk/mcs/; revision=77252
2007-05-11 19:53:11 +00:00
Jonathan Chambers 8cedf64fb3 2007-05-02 Jonathan Chambers <[email protected]>
* ExtensibleClassFactory.cs: Don't use un-implemented overload.


svn path=/trunk/mcs/; revision=76581
2007-05-02 17:53:45 +00:00
Dick Porter a084d7f6f3 2007-05-02 Dick Porter <[email protected]>
* _ConstructorInfo.cs: 
	* _EventInfo.cs: 
	* _Exception.cs: 
	* _FieldInfo.cs: 
	* _MemberInfo.cs: 
	* _MethodBase.cs: 
	* _MethodInfo.cs: 
	* _PropertyInfo.cs: 
	* _Type.cs: 
	* UCOMIMoniker.cs: 
	* AutomationProxyAttribute.cs: 
	* BestFitMappingAttribute.cs: 
	* BStrWrapper.cs: 
	* ClassInterfaceAttribute.cs: 
	* CoClassAttribute.cs: 
	* ComAliasNameAttribute.cs: 
	* ComCompatibleVersionAttribute.cs: 
	* ComConversionLossAttribute.cs: 
	* ComDefaultInterfaceAttribute.cs: 
	* ComEventInterfaceAttribute.cs: 
	* COMException.cs: 
	* ComImportAttribute.cs: 
	* ComObjectInUseException.cs: 
	* ComRegisterFunctionAttribute.cs: 
	* ComUnregisterFunctionAttribute.cs: 
	* ComVisible.cs: 
	* CriticalHandle.cs: 
	* CurrencyWrapper.cs: 
	* DefaultCharSetAttribute.cs: 
	* DispatchWrapper.cs: 
	* DispIdAttribute.cs: 
	* ErrorWrapper.cs: 
	* ExtensibleClassFactory.cs: 
	* ExternalException.cs: 
	* Marshal.cs: 
	* SafeHandle.cs: 
	* StructLayoutAttribute.cs: 
	* TypeLibConverter.cs: 
	* ArrayWithOffset.cs: 
	* BIND_OPTS.cs: 
	* BINDPTR.cs: 
	* CONNECTDATA.cs: 
	* DISPPARAMS.cs: 
	* ELEMDESC.cs: 
	* EXCEPINFO.cs: 
	* PARAMDESC.cs: 
	* TYPELIBATTR.cs: 
	* VARDESC.cs: 
	* CALLCONV.cs: 
	* CallingConvention.cs: 
	* CharSet.cs: 
	* ClassInterfaceType.cs: 
	* ComInterfaceType.cs: 
	* ComMemberType.cs: 
	* DESCKIND.cs: 
	* ExporterEventKind.cs: 
	* PARAMFLAG.cs: 
	* RegistrationClassContext.cs: 
	* TYPEKIND.cs: 
	* TypeLibImporterFlags.cs: 
	* UnmanagedType.cs: 
	* VARFLAGS.cs: Update to 2.0 profile



svn path=/trunk/mcs/; revision=76579
2007-05-02 16:38:28 +00:00
Alp Toker 401e8d8b0b 2007-04-15 Alp Toker <[email protected]>
* Marshal.cs: Add new 2.0 Copy() from IntPtr[] overload.


svn path=/trunk/mcs/; revision=75709
2007-04-15 00:26:20 +00:00
Raja R Harinath 3d693eeb90 In corlib/System.Runtime.InteropServices:
* DefaultParameterValueAttribute.cs: Move to System.dll.

In System/System.Runtime.InteropServices:
	* StandardOleMarshalObject.cs: New .net2.0 class.
	* DefaultParameterValueAttribute.cs: Move here from corlib.

svn path=/trunk/mcs/; revision=74124
2007-03-12 13:31:45 +00:00
Jonathan Chambers ae845f152d 2007-02-08 Jonathan Chambers <[email protected]>
Add support for COM Callable Wrappers.


svn path=/trunk/mcs/; revision=72505
2007-02-08 19:17:49 +00:00
Marek Habersack b1a6b94939 Implement a missing Marshal.Copy overload
svn path=/trunk/mcs/; revision=71908
2007-01-29 19:46:31 +00:00
Jonathan Chambers c7385fd3d9 2007-01-11 Jonathan Chambers <[email protected]>
* Marshal.cs: Implement Marshal.ReAllocCoTaskMem.


svn path=/trunk/mcs/; revision=70880
2007-01-11 20:01:29 +00:00
Miguel de Icaza 0c2553a2bf 2007-01-03 Miguel de Icaza <[email protected]>
* SafeHandle.cs: Do not use locks in SafeHandle to protect the
	access to the refcount, use Interlocked.CompareExchange.  The
	locks were the source of problems with domain finalization when
	this code was enabled.

	This should fix Matt Hargett's bug report with a full `make check'
	that reported variations of:

	** (../../class/lib/net_2_0/nunit-console.exe:29644): WARNING **:
	Finalization of domain <domainname> timed out.

	Also, it is a lot lighther.


svn path=/trunk/mcs/; revision=70433
2007-01-03 19:50:44 +00:00
Miguel de Icaza c694fb8e63 A little more work of CorCompare work:
2006-12-21  Miguel de Icaza  <[email protected]>

	* CriticalHandle.cs: Add Dispose(bool disposing) method, and
	refactor. 


svn path=/trunk/mcs/; revision=69920
2006-12-22 01:05:58 +00:00
Miguel de Icaza 48b34f32e8 This patch contains:
SafeWaitHandle support for WaitHandles (2.0)

        A few APIs implemented from Marshal.

2006-12-11  Miguel de Icaza  <[email protected]>

        * WaitHandle.cs: In 2.0 use SafeWaitHandles and the SafeWaitHandle
        patterns instead of using directly the IntPtr Handle.

        Refactor the code to reuse as much as possible, and follow the new
        conventions where appropriate.

2006-12-15  Miguel de Icaza  <[email protected]>

        * Marshal.cs (SecureStringToCoTaskMemAnsi, SecureStringToBSTR,
        SecureStringToCoTaskMemUnicode, ZeroFreeCoTaskMemAnsi,
        ZeroFreeCoTaskMemUnicode, ZeroFreeGlobalAllocAnsi,
        ZeroFreeGlobalAllocUnicode): Implement.

        (StringToCoTaskAuto): return the same as Ansi.

        The ANSI code is out of sync with Mono, which treats ANSI as
        UTF-8.

        Code formatting changes



svn path=/trunk/mcs/; revision=69552
2006-12-15 22:49:32 +00:00
Gert Driesen 69bf9822cd * Marshal.cs: Use SystemDefaultCharSize to determine whether to
use Ansi or Unicode variant of StringToCoTaskMem.

svn path=/trunk/mcs/; revision=69534
2006-12-15 16:26:13 +00:00
Miguel de Icaza e857759fbc 2006-12-15 Miguel de Icaza <[email protected]>
* Marshal.cs (StringToCoTaskAuto): return the same as Ansi.  

svn path=/trunk/mcs/; revision=69525
2006-12-15 05:34:51 +00:00
Miguel de Icaza d118a46d80 2006-12-15 Miguel de Icaza <[email protected]>
* Marshal.cs: Code formatting changes

svn path=/trunk/mcs/; revision=69524
2006-12-15 05:31:04 +00:00
Miguel de Icaza 24f79898c5 2006-12-11 Miguel de Icaza <[email protected]>
* SafeHandle.cs: Fix a handful of bugs, and add tests for them.
	Only release the handle if its owned by us.  Also throw
	ObjectDisposedException's


svn path=/trunk/mcs/; revision=69378
2006-12-12 00:40:52 +00:00
Miguel de Icaza a7aa6fc381 The managed side:
2006-12-11  Miguel de Icaza  <[email protected]>

	* SafeHandle.cs: Implement finalizer.

	DangerousAddRef will now throw an exception if the object was
	disposed.

2006-12-10  Miguel de Icaza  <[email protected]>

	* SafeFileHandle.cs: Implement this one.



svn path=/trunk/mcs/; revision=69296
2006-12-11 06:48:40 +00:00
Miguel de Icaza 5c6fc3889d 2006-12-02 Miguel de Icaza <[email protected]>
* SafeHandle.cs: Implement this class.

2006-12-02  Miguel de Icaza  <[email protected]>

	* SafeFileHandle.cs: Remove the IsInvalid method, as that is
	present in the base class.


svn path=/trunk/mcs/; revision=68875
2006-12-02 05:27:35 +00:00
Jonathan Chambers 03be20a099 2006-10-06 Jonathan Chambers <[email protected]>
* ExtensibleClassFactory.cs: Implement RegisterObjectCreationCallback.
	

svn path=/trunk/mcs/; revision=66358
2006-10-06 15:19:32 +00:00
Robert Jordan 7266ed972c 2006-08-31 Robert Jordan <[email protected]>
* Marshal.cs: Replaced the *Auto internal calls with managed
	variants. Fixed SystemDefaultCharSize to return an OS dependent
	value.


svn path=/trunk/mcs/; revision=64659
2006-08-31 19:53:57 +00:00
Jonathan Chambers f929cddf15 2006-08-10 Jonathan Chambers <[email protected]>
* ComInteropProxy.cs: Fix default constructor being always
	being called.
	* Marshal.cs: Implement GetIDispatchForObject.
	* __ComObject.cs: Added defintion of IDispatch interface, and
	property. Get CLSID of supertype for creation if class not
	ComImport attributed (allows for inheritance of RCW).
	* MonoType.cs: Implement IsCOMObjectImpl.

svn path=/trunk/mcs/; revision=63630
2006-08-11 02:28:50 +00:00
Gert Driesen c0bf457b7b * Marshal.cs: Added stubs for GetTypeLibGuid (ITypeLib), GetTypeLibLcid
(ITypeLib), GetTypeLibName (ITypeLib).

svn path=/trunk/mcs/; revision=63426
2006-08-07 11:07:48 +00:00