diff --git a/Source/Engine/Platform/Base/PlatformBase.h b/Source/Engine/Platform/Base/PlatformBase.h
index d3bcb8dfb..46a2fa8f9 100644
--- a/Source/Engine/Platform/Base/PlatformBase.h
+++ b/Source/Engine/Platform/Base/PlatformBase.h
@@ -167,7 +167,6 @@ DECLARE_SCRIPTING_TYPE_MINIMAL(PlatformBase);
static void Exit();
public:
-
///
/// Copy memory region
///
@@ -334,7 +333,6 @@ public:
static void FreePages(void* ptr);
public:
-
///
/// Returns the current runtime platform type. It's compile-time constant.
///
@@ -409,7 +407,6 @@ public:
static void Sleep(int32 milliseconds) = delete;
public:
-
///
/// Gets the current time in seconds.
///
@@ -455,7 +452,6 @@ public:
static void GetUTCTime(int32& year, int32& month, int32& dayOfWeek, int32& day, int32& hour, int32& minute, int32& second, int32& millisecond) = delete;
public:
-
///
/// Shows the fatal error message to the user.
///
@@ -482,7 +478,6 @@ public:
static void Info(const Char* msg);
public:
-
///
/// Shows the fatal error message to the user.
///
@@ -520,7 +515,6 @@ public:
static bool IsDebuggerPresent();
public:
-
///
/// Performs a fatal crash.
///
@@ -560,7 +554,6 @@ public:
static void CheckFailed(const char* message, const char* file, int line);
public:
-
///
/// Sets the High DPI awareness.
///
@@ -628,7 +621,6 @@ public:
static void CreateGuid(Guid& result);
public:
-
///
/// The list of users.
///
@@ -645,7 +637,6 @@ public:
API_EVENT() static Delegate UserRemoved;
public:
-
///
/// Returns a value indicating whether can open a given URL in a web browser.
///
@@ -660,7 +651,6 @@ public:
API_FUNCTION() static void OpenUrl(const StringView& url) = delete;
public:
-
///
/// Gets the origin position and size of the monitor at the given screen-space location.
///
@@ -686,7 +676,6 @@ public:
API_PROPERTY() static Float2 GetVirtualDesktopSize();
public:
-
///
/// Gets full path of the main engine directory.
///
@@ -719,7 +708,6 @@ public:
static bool SetWorkingDirectory(const String& path);
public:
-
///
/// Gets the process environment variables (pairs of key and value).
///
diff --git a/Source/Engine/Platform/Windows/WindowsPlatform.cpp b/Source/Engine/Platform/Windows/WindowsPlatform.cpp
index 2a4cd2fd4..0ac741f71 100644
--- a/Source/Engine/Platform/Windows/WindowsPlatform.cpp
+++ b/Source/Engine/Platform/Windows/WindowsPlatform.cpp
@@ -1221,10 +1221,11 @@ void* WindowsPlatform::LoadLibrary(const Char* filename)
return handle;
}
+#if CRASH_LOG_ENABLE
+
Array WindowsPlatform::GetStackFrames(int32 skipCount, int32 maxDepth, void* context)
{
Array result;
-#if CRASH_LOG_ENABLE
DbgHelpLock();
// Initialize
@@ -1350,12 +1351,9 @@ Array WindowsPlatform::GetStackFrames(int32 skipCount,
}
DbgHelpUnlock();
-#endif
return result;
}
-#if CRASH_LOG_ENABLE
-
void WindowsPlatform::CollectCrashData(const String& crashDataFolder, void* context)
{
// Create mini dump file for crash debugging
diff --git a/Source/Engine/Platform/Windows/WindowsPlatform.h b/Source/Engine/Platform/Windows/WindowsPlatform.h
index cc85a6d1e..fef8e4ac3 100644
--- a/Source/Engine/Platform/Windows/WindowsPlatform.h
+++ b/Source/Engine/Platform/Windows/WindowsPlatform.h
@@ -80,8 +80,8 @@ public:
static int32 CreateProcess(CreateProcessSettings& settings);
static Window* CreateWindow(const CreateWindowSettings& settings);
static void* LoadLibrary(const Char* filename);
- static Array GetStackFrames(int32 skipCount = 0, int32 maxDepth = 60, void* context = nullptr);
#if CRASH_LOG_ENABLE
+ static Array GetStackFrames(int32 skipCount = 0, int32 maxDepth = 60, void* context = nullptr);
static void CollectCrashData(const String& crashDataFolder, void* context = nullptr);
#endif
};
diff --git a/Source/Engine/Scripting/Runtime/DotNet.cpp b/Source/Engine/Scripting/Runtime/DotNet.cpp
index 3ae1e02d5..76f6dd89f 100644
--- a/Source/Engine/Scripting/Runtime/DotNet.cpp
+++ b/Source/Engine/Scripting/Runtime/DotNet.cpp
@@ -165,9 +165,8 @@ extern MDomain* MActiveDomain;
extern Array> MDomains;
Dictionary CachedFunctions;
-
-Dictionary classHandles;
-Dictionary assemblyHandles;
+Dictionary CachedClassHandles;
+Dictionary CachedAssemblyHandles;
///
/// Returns the function pointer to the managed static method in NativeInterop class.
@@ -672,7 +671,7 @@ bool MAssembly::LoadCorlib()
return true;
}
_hasCachedClasses = false;
- assemblyHandles.Add(_handle, this);
+ CachedAssemblyHandles.Add(_handle, this);
// End
OnLoaded(startTime);
@@ -696,7 +695,7 @@ bool MAssembly::LoadImage(const String& assemblyPath, const StringView& nativePa
Log::CLRInnerException(TEXT(".NET assembly image is invalid at ") + assemblyPath);
return true;
}
- assemblyHandles.Add(_handle, this);
+ CachedAssemblyHandles.Add(_handle, this);
// Provide new path of hot-reloaded native library path for managed DllImport
if (nativePath.HasChars())
@@ -722,7 +721,7 @@ bool MAssembly::UnloadImage(bool isReloading)
CallStaticMethod(CloseAssemblyPtr, _handle);
}
- assemblyHandles.Remove(_handle);
+ CachedAssemblyHandles.Remove(_handle);
_handle = nullptr;
}
return false;
@@ -780,7 +779,7 @@ MClass::MClass(const MAssembly* parentAssembly, void* handle, const char* name,
static void* TypeIsEnumPtr = GetStaticMethodPointer(TEXT("TypeIsEnum"));
_isEnum = CallStaticMethod(TypeIsEnumPtr, handle);
- classHandles.Add(handle, this);
+ CachedClassHandles.Add(handle, this);
}
bool MAssembly::ResolveMissingFile(String& assemblyPath) const
@@ -800,7 +799,7 @@ MClass::~MClass()
_properties.ClearDelete();
_events.ClearDelete();
- classHandles.Remove(_handle);
+ CachedClassHandles.Remove(_handle);
}
StringAnsiView MClass::GetName() const
@@ -1018,11 +1017,7 @@ const Array& MClass::GetAttributes() const
int numAttributes;
static void* GetClassAttributesPtr = GetStaticMethodPointer(TEXT("GetClassAttributes"));
CallStaticMethod(GetClassAttributesPtr, _handle, &attributes, &numAttributes);
- _attributes.Resize(numAttributes);
- for (int i = 0; i < numAttributes; i++)
- {
- _attributes[i] = attributes[i];
- }
+ _attributes.Set(attributes, numAttributes);
MCore::GC::FreeMemory(attributes);
_hasCachedAttributes = true;
@@ -1444,7 +1439,7 @@ const Array& MProperty::GetAttributes() const
MAssembly* GetAssembly(void* assemblyHandle)
{
MAssembly* assembly;
- if (assemblyHandles.TryGet(assemblyHandle, assembly))
+ if (CachedAssemblyHandles.TryGet(assemblyHandle, assembly))
return assembly;
return nullptr;
}
@@ -1452,7 +1447,7 @@ MAssembly* GetAssembly(void* assemblyHandle)
MClass* GetClass(MType* typeHandle)
{
MClass* klass = nullptr;
- classHandles.TryGet(typeHandle, klass);
+ CachedClassHandles.TryGet(typeHandle, klass);
return nullptr;
}
@@ -1461,7 +1456,7 @@ MClass* GetOrCreateClass(MType* typeHandle)
if (!typeHandle)
return nullptr;
MClass* klass;
- if (!classHandles.TryGet(typeHandle, klass))
+ if (!CachedClassHandles.TryGet(typeHandle, klass))
{
NativeClassDefinitions classInfo;
void* assemblyHandle;