Skip to content

Commit 221a877

Browse files
Cache failed dynamic calls to avoid loading all assemblies each time.
1 parent ef24acc commit 221a877

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

dotnet/src/dotnetframework/GxClasses/Helpers/GXMetadata.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,8 @@ static public Type FindType(string defaultAssemblyName, string ns, string clssWi
8383
string clss = string.IsNullOrEmpty(ns) ? clssWithoutNamespace : string.Format("{0}.{1}", ns, clssWithoutNamespace);
8484
Type objType = null;
8585
string appNS;
86-
loadedAssemblies.TryGetValue(clss, out objType);
87-
if (objType == null)
88-
{
86+
if (!loadedAssemblies.TryGetValue(clss, out objType))
87+
{
8988
if (defaultAssembly != null)
9089
{
9190
try
@@ -199,15 +198,15 @@ static public Type FindType(string defaultAssemblyName, string ns, string clssWi
199198
}
200199
}
201200

202-
if (objType == null)
203-
{
204-
GXLogging.Error(log, "Failed to load type: " + clss + " from currentdomain");
205-
throw new GxClassLoaderException("Failed to load type: " + clss);
206-
}
207201
}
208202

209203
loadedAssemblies[clss] = objType;
210204
}
205+
if (objType == null)
206+
{
207+
GXLogging.Error(log, "Failed to load type: " + clss + " from currentdomain");
208+
throw new GxClassLoaderException("Failed to load type: " + clss);
209+
}
211210
return objType;
212211

213212
}

0 commit comments

Comments
 (0)