Prevent dump output for unused `loaded class`/`class name` related information.
Move `loaded class` metadata gathering related code execution to proper place
(will be right before dump output message forming at first usage of class).
}
}
+ if (this->moduleId)
+ this->needPrintLoadFinished = true;
+
this->isInitialized = true;
return hrReturn;
}
String arrayBrackets;
String fullName;
bool isInitialized;
+ bool needPrintLoadFinished;
bool isNamePrinted;
+ HRESULT hrStatus;
public:
static HRESULT GetClassNameFromMetaData(
{
auto storage_lock = m_classStorage.lock();
ClassInfo &classInfo = storage_lock->Get(classId);
- hr = classInfo.Initialize(m_profiler, *storage_lock);
-
- TRACE().DumpClassLoadFinished(classInfo, hrStatus);
- if (!classInfo.isNamePrinted)
- {
- TRACE().DumpClassName(classInfo);
- classInfo.isNamePrinted = true;
- }
+ // Note, we don't initialize class related data here, since we will initialize it later at this class object allocation or GC related work.
+ // hrStatus - HRESULT that indicates whether the class loaded successfully, must be stored here, since it can be received in this callback only.
+ classInfo.hrStatus = hrStatus;
}
catch (const std::exception &e)
{
}
_ASSERTE(objInfo.type != nullptr);
+ if (objInfo.type->needPrintLoadFinished)
+ {
+ TRACE().DumpClassLoadFinished(*objInfo.type, objInfo.type->hrStatus);
+ objInfo.type->needPrintLoadFinished = false;
+ }
if (!objInfo.type->isNamePrinted)
{
TRACE().DumpClassName(*objInfo.type);
}
_ASSERTE(objInfo.type != nullptr);
+ if (objInfo.type->needPrintLoadFinished)
+ {
+ TRACE().DumpClassLoadFinished(*objInfo.type, objInfo.type->hrStatus);
+ objInfo.type->needPrintLoadFinished = false;
+ }
if (!objInfo.type->isNamePrinted)
{
TRACE().DumpClassName(*objInfo.type);