diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Application.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Application.cs index 0593bbdb3c45aa9206b14523ea79a757f1a9650a..275a575c0d764dfc5698c6e5f2c2d516414972dd 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Application.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Application.cs @@ -700,7 +700,8 @@ public static StreamResourceInfo GetRemoteStream(Uri uriRemote) SiteOfOriginContainer sooContainer = (SiteOfOriginContainer)GetResourcePackage(packageUri); // the SiteOfOriginContainer is shared across threads; synchronize access to it - lock (_packageLock) + // using the same lock object as other uses (PackWebResponse+CachedResponse.GetResponseStream) + lock (sooContainer) { sooPart = sooContainer.GetPart(partUri) as SiteOfOriginPart; } @@ -2017,8 +2018,9 @@ private static PackagePart GetResourceOrContentPart(Uri uri) ResourceContainer resContainer = (ResourceContainer)GetResourcePackage(packageUri); // the ResourceContainer is shared across threads; synchronize access to it + // using the same lock object as other uses (PackWebResponse+CachedResponse.GetResponseStream) PackagePart part = null; - lock (_packageLock) + lock (resContainer) { part = resContainer.GetPart(partUri); } @@ -2417,7 +2419,6 @@ private object RunDispatcher(object ignore) static private bool _appCreatedInThisAppDomain; static private Application _appInstance; static private Assembly _resourceAssembly; - static private object _packageLock = new Object(); // Keep LoadBamlSyncInfo stack so that the Outer LoadBaml and Inner LoadBaml( ) for the same // Uri share the related information.