void iContent.resized(ref sWindowPosition position) { // ConsoleLogger.logDebug( "{0}", position ); try { // No need to waste resources rendering frames while the window is minimized. if (position.show == eShowWindow.Minimized) { if (null == timersHardPause) { animation.timers.pause(); } Dispatcher.currentDispatcher.nativeDispatcher.runPolicy = eDispatcherRunPolicy.EnvironmentFriendly; } else { if (null == timersHardPause && animation.any) { animation.timers.resume(); Dispatcher.currentDispatcher.nativeDispatcher.runPolicy = eDispatcherRunPolicy.GameStyle; } } ComUtils.clear(ref cachedRtv); ComUtils.clear(ref cachedDsv); context?.SetRenderTargets(0, null, null, ResourceStateTransitionMode.None); windowState = position.show; if (dpiScalingFactor != position.dpiScaling) { dpiScalingFactor = position.dpiScaling; var evt = m_dpiChanged; if (null != evt) { foreach (var sub in evt) { sub(dpiScalingFactor); } } } if (position.show != eShowWindow.Minimized) { foreach (var rr in releaseResources) { rr(eReleaseResources.Buffers); } swapChain?.Resize(position.size.cx, position.size.cy); swapChainSize = position.size; foreach (var sub in swapChainResized) { sub(position.size, position.dpiScaling); } } } catch (Exception ex) { // This is to marshal that exception across C++ code on the stack. C++ can't deliver .NET exceptions, it only knows about HRESULT codes. // cacheException call makes it so the complete .NET exception is delivered to the caller, not just the HRESULT code of it. NativeContext.cacheException(ex); throw; } }