130 references to GCHandleType
aspire (1)
Processes\DetachedProcessLauncher.Windows.cs (1)
61var pinnedHandles = GCHandle.Alloc(handles, GCHandleType.Pinned);
ILCompiler.ReadyToRun (2)
src\runtime\src\coreclr\tools\Common\JitInterface\CorInfoImpl.cs (1)
651handle = GCHandle.Alloc(obj, GCHandleType.Pinned);
TypeSystem\Mutable\MutableModule.cs (1)
216System.Runtime.InteropServices.GCHandle.Alloc(metadataArray, System.Runtime.InteropServices.GCHandleType.Pinned);
ILCompiler.RyuJit (1)
src\runtime\src\coreclr\tools\Common\JitInterface\CorInfoImpl.cs (1)
651handle = GCHandle.Alloc(obj, GCHandleType.Pinned);
Microsoft.AspNetCore.Server.HttpSys (1)
RequestProcessing\ResponseBody.cs (1)
274handle = GCHandle.Alloc(buffer.Array, GCHandleType.Pinned);
Microsoft.CSharp (1)
Microsoft\CSharp\RuntimeBinder\ComInterop\ComRuntimeHelpers.cs (1)
327pinningHandle = GCHandle.Alloc(null, GCHandleType.Pinned);
Microsoft.ML.LightGbm (2)
WrappedLightGbmDataset.cs (2)
60gcValues[i] = GCHandle.Alloc(sampleValuePerColumn[i], GCHandleType.Pinned); 62gcIndices[i] = GCHandle.Alloc(sampleIndicesPerColumn[i], GCHandleType.Pinned);
Microsoft.ML.Mkl.Components (2)
SymSgdClassificationTrainer.cs (2)
346GcHandle = GCHandle.Alloc(Buffer, GCHandleType.Pinned); 739stateGCHandle = GCHandle.Alloc(state, GCHandleType.Pinned);
Microsoft.ML.Vision (2)
ImageClassificationTrainer.cs (2)
975var featureBufferHandle = GCHandle.Alloc(featuresBuffer, GCHandleType.Pinned); 977var labelBufferHandle = GCHandle.Alloc(labelBuffer, GCHandleType.Pinned);
Microsoft.NET.StringTools (1)
WeakStringCache.cs (1)
80weakHandle = GCHandle.Alloc(str, GCHandleType.Weak);
Mono.Cecil.Pdb (1)
Mono.Cecil.Pdb\SymWriter.cs (1)
153 var handle = GCHandle.Alloc (metadata, GCHandleType.Pinned);
mscorlib (1)
src\runtime\src\libraries\shims\mscorlib\ref\mscorlib.cs (1)
692[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.InteropServices.GCHandleType))]
netstandard (1)
netstandard.cs (1)
1697[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.InteropServices.GCHandleType))]
System.Data.OleDb (3)
ColumnBinding.cs (3)
700_pinnedBuffer = GCHandle.Alloc(value, GCHandleType.Pinned); 747_pinnedBuffer = GCHandle.Alloc(value, GCHandleType.Pinned); 766_pinnedBuffer = GCHandle.Alloc(value, GCHandleType.Pinned);
System.Diagnostics.EventLog (4)
System\Diagnostics\EventLog.cs (2)
890GCHandle stringsRoot = GCHandle.Alloc(addresses, GCHandleType.Pinned); 901handles[i] = GCHandle.Alloc(insertionStrings[i], GCHandleType.Pinned);
System\Diagnostics\EventLogInternal.cs (2)
1381GCHandle stringsRootHandle = GCHandle.Alloc(stringRoots, GCHandleType.Pinned); 1386stringHandles[strIndex] = GCHandle.Alloc(strings[strIndex], GCHandleType.Pinned);
System.DirectoryServices (2)
Interop\AdsValueHelper2.cs (2)
265_pinnedHandle = GCHandle.Alloc(managedValue, GCHandleType.Pinned); 274_pinnedHandle = GCHandle.Alloc(bytes, GCHandleType.Pinned);
System.Drawing.Common (1)
System\Drawing\Font.cs (1)
293GCHandle handle = GCHandle.Alloc(logFont, GCHandleType.Pinned);
System.Net.Http.WinHttpHandler (3)
System\Net\Http\WinHttpHandler.cs (1)
1310GCHandle pinnedHandle = GCHandle.Alloc(proxyInfo, GCHandleType.Pinned);
System\Net\Http\WinHttpRequestState.cs (2)
171_cachedReceivePinnedBuffer = GCHandle.Alloc(buffer, GCHandleType.Pinned); 184_cachedSendPinnedBuffer = GCHandle.Alloc(buffer, GCHandleType.Pinned);
System.Net.Quic (5)
System\Net\Quic\QuicConnection.cs (2)
319GCHandle context = GCHandle.Alloc(this, GCHandleType.Weak); 353GCHandle context = GCHandle.Alloc(this, GCHandleType.Weak);
System\Net\Quic\QuicListener.cs (1)
123GCHandle context = GCHandle.Alloc(this, GCHandleType.Weak);
System\Net\Quic\QuicStream.cs (2)
198GCHandle context = GCHandle.Alloc(this, GCHandleType.Weak); 240GCHandle context = GCHandle.Alloc(this, GCHandleType.Weak);
System.Net.Sockets (3)
System\Net\Sockets\SocketPal.Unix.cs (3)
311handles[i] = GCHandle.Alloc(buffer.Array, GCHandleType.Pinned); 425handles[i] = GCHandle.Alloc(buffer.Array, GCHandleType.Pinned); 564handles[i] = GCHandle.Alloc(buffer.Array, GCHandleType.Pinned);
System.Numerics.Tensors (1)
System\Numerics\Tensors\netcore\Tensor_1.cs (1)
210GCHandle handle = GCHandle.Alloc(_values, GCHandleType.Pinned);
System.Private.CoreLib (46)
Internal\Runtime\Augments\RuntimeAugments.cs (1)
694public static IntPtr RhHandleAlloc(object value, GCHandleType type)
src\runtime\src\coreclr\nativeaot\Common\src\Internal\Runtime\CompilerHelpers\StartupCodeHelpers.cs (1)
42s_moduleGCStaticsSpines = RuntimeImports.RhHandleAlloc(gcStaticBaseSpines, GCHandleType.Normal);
src\runtime\src\coreclr\nativeaot\Runtime.Base\src\System\Runtime\InternalCalls.cs (1)
64internal static extern IntPtr RhpHandleAlloc(object value, GCHandleType type);
src\runtime\src\libraries\System.Private.CoreLib\src\System\ComAwareWeakReference.cs (2)
136nint newHandle = GCHandle.InternalAlloc(newRef, GCHandleType.Normal); 174nint newHandle = GCHandle.InternalAlloc(comAwareRef, GCHandleType.Normal);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventProvider.cs (1)
622rgGCHandle[i] = GCHandle.Alloc(dataRefObj[i], GCHandleType.Pinned);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\TraceLogging\DataCollector.cs (1)
327*pinsTemp = GCHandle.Alloc(value, GCHandleType.Pinned);
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\PinnedBufferMemoryStream.cs (1)
22_pinningHandle = GCHandle.Alloc(array, GCHandleType.Pinned);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Memory.cs (2)
401GCHandle handle = GCHandle.Alloc(tmpObject, GCHandleType.Pinned); 420GCHandle handle = GCHandle.Alloc(tmpObject, GCHandleType.Pinned);
src\runtime\src\libraries\System.Private.CoreLib\src\System\ReadOnlyMemory.cs (2)
316GCHandle handle = GCHandle.Alloc(tmpObject, GCHandleType.Pinned); 335GCHandle handle = GCHandle.Alloc(tmpObject, GCHandleType.Pinned);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\ComWrappers.cs (4)
596_proxyHandle = GCHandle.Alloc(comProxy, GCHandleType.Weak); 603_proxyHandleTrackingResurrection = GCHandle.Alloc(comProxy, GCHandleType.WeakTrackResurrection); 704_nativeObjectWrapperWeakHandle = GCHandle.Alloc(this, GCHandleType.Weak); 1322rcwEntry = GCHandle.Alloc(wrapper, GCHandleType.Weak);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\GCHandle.cs (6)
34private GCHandle(object? value, GCHandleType type) 37if ((uint)type > (uint)GCHandleType.Pinned) // IMPORTANT: This must be kept in sync with the GCHandleType enum. 42if (type == GCHandleType.Pinned && !Marshal.IsPinnable(value)) 49if (type == GCHandleType.Pinned) 65public static GCHandle Alloc(object? value) => new GCHandle(value, GCHandleType.Normal); 72public static GCHandle Alloc(object? value, GCHandleType type) => new GCHandle(value, type);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\GCHandle.T.cs (2)
14/// <para>This type corresponds to <see cref="GCHandleType.Normal"/>.</para> 35_handle = GCHandle.InternalAlloc(target, GCHandleType.Normal);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\PinnedGCHandle.T.cs (2)
15/// <para>This type corresponds to <see cref="GCHandleType.Pinned"/>.</para> 37_handle = GCHandle.InternalAlloc(target, GCHandleType.Pinned);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\WeakGCHandle.T.cs (4)
14/// <para>This type corresponds to <see cref="GCHandleType.Weak"/> or <see cref="GCHandleType.WeakTrackResurrection"/>.</para> 36_handle = GCHandle.InternalAlloc(target, trackResurrection ? GCHandleType.WeakTrackResurrection : GCHandleType.Weak);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\Loader\AssemblyLoadContext.cs (3)
102var thisHandle = GCHandle.Alloc(this, IsCollectible ? GCHandleType.WeakTrackResurrection : GCHandleType.Normal); 148var thisStrongHandle = GCHandle.Alloc(this, GCHandleType.Normal);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\Overlapped.cs (2)
171GCHandleRef(pNativeOverlapped, (nuint)(i + 1)) = GCHandle.Alloc(objArray[i], GCHandleType.Pinned); 177GCHandleRef(pNativeOverlapped, 1) = GCHandle.Alloc(userData, GCHandleType.Pinned);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\WaitSubsystem.HandleManager.Unix.cs (1)
49IntPtr handle = GCHandle.ToIntPtr(GCHandle.Alloc(waitableObject, GCHandleType.Normal));
src\runtime\src\libraries\System.Private.CoreLib\src\System\WeakReference.cs (2)
83nint h = GCHandle.InternalAlloc(target, trackResurrection ? GCHandleType.WeakTrackResurrection : GCHandleType.Weak);
src\runtime\src\libraries\System.Private.CoreLib\src\System\WeakReference.T.cs (2)
83nint h = GCHandle.InternalAlloc(target, trackResurrection ? GCHandleType.WeakTrackResurrection : GCHandleType.Weak);
System\Runtime\InteropServices\GCHandle.NativeAot.cs (1)
10internal static IntPtr InternalAlloc(object value, GCHandleType type) => RuntimeImports.RhHandleAlloc(value, type);
System\Runtime\RuntimeImports.cs (3)
254private static extern IntPtr RhpHandleAlloc(object value, GCHandleType type); 256internal static IntPtr RhHandleAlloc(object value, GCHandleType type) 267return RhHandleAlloc(value, (GCHandleType)HNDTYPE_REFCOUNTED);
System\RuntimeType.NativeAot.cs (2)
35_runtimeTypeInfoHandle = RuntimeImports.RhHandleAlloc(runtimeTypeInfo, GCHandleType.Normal); 77IntPtr tempHandle = RuntimeImports.RhHandleAlloc(runtimeTypeInfo, GCHandleType.Weak);
System.Private.TypeLoader (1)
Internal\Runtime\TypeLoader\EETypeCreator.cs (1)
343gcStaticData = RuntimeAugments.RhHandleAlloc(obj, GCHandleType.Normal);
System.Private.Windows.Core (1)
Windows\Win32\System\Variant\VARIANT.cs (1)
276pin = GCHandle.Alloc(array, GCHandleType.Pinned);
System.Reflection.Metadata (2)
System\Reflection\Internal\Utilities\PinnedObject.cs (1)
28_handle = GCHandle.Alloc(obj, GCHandleType.Pinned);
System\Reflection\Metadata\Internal\VirtualHeap.cs (1)
103var blob = new PinnedBlob(GCHandle.Alloc(value, GCHandleType.Pinned), value.Length);
System.Resources.Extensions (1)
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\PinnedBufferMemoryStream.cs (1)
22_pinningHandle = GCHandle.Alloc(array, GCHandleType.Pinned);
System.Runtime (1)
src\runtime\artifacts\obj\System.Runtime\Release\net11.0\System.Runtime.Forwards.cs (1)
689[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.InteropServices.GCHandleType))]
System.Runtime.InteropServices (1)
src\runtime\artifacts\obj\System.Runtime.InteropServices\Release\net11.0\System.Runtime.InteropServices.Forwards.cs (1)
92[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.InteropServices.GCHandleType))]
System.Runtime.InteropServices.JavaScript (8)
System\Runtime\InteropServices\JavaScript\JSHostImplementation.Types.cs (1)
26GCHandle = (IntPtr)InteropServices.GCHandle.Alloc(this, GCHandleType.Normal);
System\Runtime\InteropServices\JavaScript\JSMarshalerType.cs (1)
264/// ArraySegment will hold <see cref="GCHandleType.Pinned"/> to underlying array until disposed or garbage collected on JS side.
System\Runtime\InteropServices\JavaScript\JSProxyContext.cs (2)
315public IntPtr GetJSOwnedObjectGCHandle(object obj, GCHandleType handleType = GCHandleType.Normal)
System\Runtime\InteropServices\JavaScript\Marshaling\JSMarshalerArgument.Byte.cs (1)
145slot.GCHandle = ctx.GetJSOwnedObjectGCHandle(value.Array, GCHandleType.Pinned);
System\Runtime\InteropServices\JavaScript\Marshaling\JSMarshalerArgument.Double.cs (1)
151slot.GCHandle = ctx.GetJSOwnedObjectGCHandle(value.Array, GCHandleType.Pinned);
System\Runtime\InteropServices\JavaScript\Marshaling\JSMarshalerArgument.Int32.cs (1)
145slot.GCHandle = ctx.GetJSOwnedObjectGCHandle(value.Array, GCHandleType.Pinned);
System\Runtime\InteropServices\JavaScript\Marshaling\JSMarshalerArgument.Single.cs (1)
151slot.GCHandle = ctx.GetJSOwnedObjectGCHandle(value.Array, GCHandleType.Pinned);
System.Security.Cryptography (1)
System\Security\Cryptography\CryptoStream.cs (1)
724GCHandle pinHandle = GCHandle.Alloc(rentedBuffer, GCHandleType.Pinned);
System.Security.Principal.Windows (1)
System\Security\Principal\SID.cs (1)
970HandleArray[currentSid] = GCHandle.Alloc(sid.BinaryForm, GCHandleType.Pinned);
System.ServiceProcess.ServiceController (1)
System\ServiceProcess\ServiceController.cs (1)
896argPtrsHandle = GCHandle.Alloc(argPtrs, GCHandleType.Pinned);
System.Speech (24)
Internal\SapiInterop\SapiRecoInterop.cs (3)
476GCHandle handle = GCHandle.Alloc(word.Text, GCHandleType.Pinned); 483GCHandle handle = GCHandle.Alloc(word.LexicalForm, GCHandleType.Pinned); 494GCHandle handle = GCHandle.Alloc(word.Pronunciation, GCHandleType.Pinned);
Internal\Synthesis\AudioBase.cs (3)
380GCHandle gc = GCHandle.Alloc(waveHeader, GCHandleType.Pinned); 403GCHandle gc = GCHandle.Alloc(waveHeader, GCHandleType.Pinned); 413GCHandle gc = GCHandle.Alloc(this, GCHandleType.Pinned);
Internal\Synthesis\ConvertTextFrag.cs (4)
33sapiFrag.gcText = GCHandle.Alloc(textFragment.TextToSpeak, GCHandleType.Pinned); 67sapiFrag.gcPhoneme = GCHandle.Alloc(ssmlState.Phoneme, GCHandleType.Pinned); 109sapiFragLast = GCHandle.Alloc(sapiFrag, GCHandleType.Pinned); 120sapiFrag.gcSayAsCategory = GCHandle.Alloc(sFormat, GCHandleType.Pinned);
Internal\Synthesis\TTSEngineProxy.cs (2)
61GCHandle gc = GCHandle.Alloc(wfx, GCHandleType.Pinned); 148GCHandle gc = GCHandle.Alloc(wfx, GCHandleType.Pinned);
Internal\Synthesis\TTSVoice.cs (1)
98targetFormat = GCHandle.Alloc(targetWaveFormat, GCHandleType.Pinned);
Internal\Synthesis\WaveHeader.cs (2)
20_gcHandle = GCHandle.Alloc(buffer, GCHandleType.Pinned); 79_gcHandleWaveHdr = GCHandle.Alloc(_waveHdr, GCHandleType.Pinned);
Recognition\RecognizerBase.cs (1)
1578GCHandle gcHandle = GCHandle.Alloc(data, GCHandleType.Pinned);
Result\RecognitionResult.cs (4)
156GCHandle gc = GCHandle.Alloc(_sapiAudioBlob, GCHandleType.Pinned); 296GCHandle gc = GCHandle.Alloc(sapiResultBlob, GCHandleType.Pinned); 357GCHandle gc = GCHandle.Alloc(_sapiAlternatesBlob, GCHandleType.Pinned); 484GCHandle gc = GCHandle.Alloc(_phraseBuffer, GCHandleType.Pinned);
Result\RecognizedPhrase.cs (4)
166GCHandle gc = GCHandle.Alloc(_phraseBuffer, GCHandleType.Pinned); 290GCHandle gc = GCHandle.Alloc(_phraseBuffer, GCHandleType.Pinned); 412GCHandle gc = GCHandle.Alloc(_phraseBuffer, GCHandleType.Pinned); 782GCHandle gc = GCHandle.Alloc(_phraseBuffer, GCHandleType.Pinned);
System.Windows.Forms (4)
System\Windows\Forms\Control.ControlNativeWindow.cs (1)
43_rootRef = GCHandle.Alloc(GetControl(), GCHandleType.Normal);
System\Windows\Forms\NativeWindow.cs (2)
245GCHandle root = GCHandle.Alloc(window, GCHandleType.Weak); 735s_windowHandles[hwnd] = GCHandle.Alloc(window.PreviousWindow, GCHandleType.Weak);
System\Windows\Forms\NotifyIcon.NotifyIconNativeWindow.cs (1)
43_rootRef = GCHandle.Alloc(_reference, GCHandleType.Normal);