예제 #1
0
        public static HResult CreateDebuggingInterfaceFromVersion2(int debuggerVersion, string versionString, string applicationGroupId, out ICorDebug cordbg)
        {
            HResult hr = _createDebuggingInterfaceFromVersion2(debuggerVersion, versionString, applicationGroupId, out IntPtr punk);

            cordbg = ICorDebug.Create(punk);
            return(hr);
        }
예제 #2
0
        public static HResult CreateDebuggingInterfaceFromVersion(string versionString, out ICorDebug cordbg)
        {
            HResult hr = _createDebuggingInterfaceFromVersion(versionString, out IntPtr punk);

            cordbg = ICorDebug.Create(punk);
            return(hr);
        }
예제 #3
0
        public static HResult CreateDebuggingInterfaceFromVersion3(int debuggerVersion, string versionString, string applicationGroupId, IntPtr libraryProvider, out ICorDebug cordbg)
        {
            if (_createDebuggingInterfaceFromVersion3 == default)
            {
                throw new NotSupportedException("CreateDebuggingInterfaceFromVersion3 not supported");
            }
            HResult hr = _createDebuggingInterfaceFromVersion3(debuggerVersion, versionString, applicationGroupId, libraryProvider, out IntPtr punk);

            cordbg = ICorDebug.Create(punk);
            return(hr);
        }
예제 #4
0
        private static IntPtr RuntimeStartupCallback(object parameter, RuntimeStartupCallbackDelegate callback, out IntPtr nativeParameter)
        {
            NativeRuntimeStartupCallbackDelegate native = (IntPtr cordbg, IntPtr param, HResult hresult) => {
                GCHandle gch = GCHandle.FromIntPtr(param);
                callback(ICorDebug.Create(cordbg), gch.Target, hresult);
                gch.Free();
            };
            GCHandle gchParameter = GCHandle.Alloc(parameter);

            nativeParameter = GCHandle.ToIntPtr(gchParameter);
            return(Marshal.GetFunctionPointerForDelegate(native));
        }
예제 #5
0
        private static IntPtr RuntimeStartupCallback(object parameter, RuntimeStartupCallbackDelegate callback, out GCHandle nativeCallbackHandle, out IntPtr nativeParameter)
        {
            NativeRuntimeStartupCallbackDelegate native = (IntPtr cordbg, IntPtr param, HResult hresult) => {
                GCHandle gch = GCHandle.FromIntPtr(param);
                callback(ICorDebug.Create(cordbg), gch.Target, hresult);
                gch.Free();
            };

            // Need to keep native callback delegate alive until UnregisterForRuntimeStartup
            nativeCallbackHandle = GCHandle.Alloc(native);

            // Need to keep parameter alive until the callback is invoked
            GCHandle gchParameter = GCHandle.Alloc(parameter);

            nativeParameter = GCHandle.ToIntPtr(gchParameter);

            // Return the function pointer for the native callback
            return(Marshal.GetFunctionPointerForDelegate(native));
        }