Skip to content

Commit

Permalink
Fix null reference exception in library mode (#1546)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkotas authored Sep 9, 2021
1 parent 6f2cfcd commit 4d83e37
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ internal static void InitializeEntryAssembly(RuntimeTypeHandle entryAssemblyType
s_entryAssemblyType = entryAssemblyType;
}

internal static Assembly GetEntryAssembly()
internal static Assembly? GetEntryAssembly()
{
return Type.GetTypeFromHandle(s_entryAssemblyType).Assembly;
return Type.GetTypeFromHandle(s_entryAssemblyType)?.Assembly;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace System.Reflection
{
public abstract partial class Assembly : ICustomAttributeProvider, ISerializable
{
private static Assembly GetEntryAssemblyInternal() => Internal.Runtime.CompilerHelpers.StartupCodeHelpers.GetEntryAssembly();
private static Assembly? GetEntryAssemblyInternal() => Internal.Runtime.CompilerHelpers.StartupCodeHelpers.GetEntryAssembly();

[System.Runtime.CompilerServices.Intrinsic]
public static Assembly GetExecutingAssembly() { throw NotImplemented.ByDesign; } //Implemented by toolchain.
Expand Down

0 comments on commit 4d83e37

Please sign in to comment.