Skip to content

Commit

Permalink
ProviderTypeLoader: do not enumerate types in ReflectionOnly assembly…
Browse files Browse the repository at this point in the history
…. Improve logging. (dotnet#2869)
  • Loading branch information
ReubenBond authored and jdom committed Mar 22, 2017
1 parent a823789 commit 1b5ca25
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Orleans/CodeGeneration/TypeUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,8 @@ public static IEnumerable<TypeInfo> GetDefinedTypes(Assembly assembly, Logger lo
{
if (logger != null && logger.IsWarning)
{
var message = $"AssemblyLoader encountered an exception loading types from assembly '{assembly.FullName}': {exception}";
var message =
$"Exception loading types from assembly '{assembly.FullName}': {LogFormatter.PrintException(exception)}.";
logger.Warn(ErrorCode.Loader_TypeLoadError_5, message, exception);
}

Expand Down
8 changes: 8 additions & 0 deletions src/Orleans/Providers/ProviderTypeLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,14 @@ private void ProcessAssemblyLocally(Assembly assembly)

private static void ProcessNewAssembly(object sender, AssemblyLoadEventArgs args)
{
#if !NETSTANDARD
// If the assembly is loaded for reflection only avoid processing it.
if (args.LoadedAssembly.ReflectionOnly)
{
return;
}
#endif

// We do this under the lock to avoid race conditions when an assembly is added
// while a type manager is initializing.
lock (managers)
Expand Down

0 comments on commit 1b5ca25

Please sign in to comment.