Repository: dotnet/runtime
File: src/libraries/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyLoadContext.cs (C#)

Code before:
            return null;
        }

#if CORECLR
        // UnmanagedCallersOnly wrappers for VM callbacks
        // These methods provide efficient reverse P/Invoke entry points for the VM.

        [UnmanagedCallersOnly]
        private static unsafe void OnAssemblyLoad(RuntimeAssembly* pAssembly, Exception* pException)
        {
            try
            {
                OnAssemblyLoad(*pAssembly);
            }
            catch (Exception ex)
            {
                *pException = ex;
            }
        }

        [UnmanagedCallersOnly]
        private static unsafe void OnTypeResolve(RuntimeAssembly* pAssembly, sbyte* typeName, RuntimeAssembly* ppResult, Exception* pException)
        {
            try
            {
                *ppResult = OnTypeResolve(*pAssembly, new string(typeName));
            }
            catch (Exception ex)
            {
                *pException = ex;
            }
        }

        [UnmanagedCallersOnly]
        private static unsafe void OnResourceResolve(RuntimeAssembly* pAssembly, sbyte* resourceName, RuntimeAssembly* ppResult, Exception* pException)
        {
            try
            {
                *ppResult = OnResourceResolve(*pAssembly, new string(resourceName));
            }
            catch (Exception ex)
            {
                *pException = ex;
            }
        }

        [UnmanagedCallersOnly]
        private static unsafe void OnAssemblyResolve(RuntimeAssembly* pAssembly, char* assemblyFullName, RuntimeAssembly* ppResult, Exception* pException)
        {
            try
            {

Review comment (suggestion):
`new string(sbyte*)` uses `CP_ACP` on Windows. I do not think you want that here. This should use `Utf8StringMarshaller.ConvertToManaged` or something like that.

Also, I would use `byte*` for the `typeName`. `byte*` is typically used for UTF8 throughout the BCL.

Code after:

            return null;
        }

#if CORECLR
        // UnmanagedCallersOnly wrappers for VM callbacks
        // These methods provide efficient reverse P/Invoke entry points for the VM.

        [UnmanagedCallersOnly]
        private static unsafe void OnAssemblyLoad(RuntimeAssembly* pAssembly, Exception* pException)
        {
            try
            {
                OnAssemblyLoad(*pAssembly);
            }
            catch (Exception)
            {
                // The VM does not expect exceptions to propagate out of this callback
            }
        }

        [UnmanagedCallersOnly]
        private static unsafe void OnTypeResolve(RuntimeAssembly* pAssembly, byte* typeName, RuntimeAssembly* ppResult, Exception* pException)
        {
            try
            {
                string name = Utf8StringMarshaller.ConvertToManaged(typeName)!;
                *ppResult = OnTypeResolve(*pAssembly, name);
            }
            catch (Exception ex)
            {
                *pException = ex;
            }
        }

        [UnmanagedCallersOnly]
        private static unsafe void OnResourceResolve(RuntimeAssembly* pAssembly, byte* resourceName, RuntimeAssembly* ppResult, Exception* pException)
        {
            try
            {
                string name = Utf8StringMarshaller.ConvertToManaged(resourceName)!;
                *ppResult = OnResourceResolve(*pAssembly, name);
            }
            catch (Exception ex)
            {
                *pException = ex;
            }
        }

        [UnmanagedCallersOnly]
        private static unsafe void OnAssemblyResolve(RuntimeAssembly* pAssembly, char* assemblyFullName, RuntimeAssembly* ppResult, Exception* pException)