Webview2 Winforms
Hi All,
We are using XenApp: 7.6. We have a .NET full framework 4.8 WinForms application as a published application within Citrix Receiver. This published application is hosted on a Windows Server 2008 R2 SP1 (64 bit) machine. Our application uses the Microsoft.Web.WebView2 (1.0.824-prerelease) web browser winforms control to provide an embedded web browser within our application.
Our application works without any issues when running as a regular desktop application on the same Windows Server 2008 R2 SP1 server used to deliver the published application. Our application also works without any issues when running as a regular desktop application on Windows 10 and Windows Server 2012.
When we launch our application as a published application via Citrix Receiver we see a REGDB_E_CLASSNOTREG error at runtime when the Microsoft.Web.WebView2 winforms control attempts to create a webview2 environment. You can see the runtime exception below...
The same application works without any issues when launched via the same Citrix Receiver portal using a Citrix published desktop and not a Citrix published application.
The WebView2WindowsFormsBrowser is an example of an application that embeds a WebView within a Windows Forms application. It is built as a Windows Forms Visual Studio 2019 project and makes use of both C# and HTML/CSS/JavaScript in the WebView2 environment. Jan 14, 2021 The Microsoft Edge WebView2 control is a new Chromium based Web Browser control that aims to replace the Internet Explorer based WebBrowser control that's commonly used in WPF and WinForms.
Using ProcMon on the server when launching the published application I can see our application ultimately makes a call into C:Program Files (x86)MicrosoftEdgeWebViewApplication89.0.774.54EBWebViewx64EmbeddedBrowserWebView.dll which I believe then launches the msedgewebview2.exe process. We can see the msedgewebview2.exe executable is being launched successfully for the published app. This is shown below with the command arguments passed to msedgewebview2.exe...
Things I have tried
- I've used ProcMon to identify all CLSIDs being loaded when launching our application as a published Citrix application and verified all 32-bit & 64-bit CLSIDs exist. I've also attempted to re-register a number of DLL's using RegSvr32 in both System32 & SysWOW64 folders
- I've used ProcMon to identify all dependencies being loaded and verified these dependeices exist. I used a combination of ProcMon and dependencywalker to verify all DLLs are present.
- I've veriried all COM permissions are correct via 'dcomcnfg' & 'mmc comexp.msc /32'
- Attempted all steps here https://support.microsoft.com/en-us/topic/-access-denied-errors-and-applications-with-com-activation-fail-after-installing-july-2018-security-and-quality-rollup-updates-for-net-framework-fd3d7a3f-ca2f-6e87-c409-a5652175cf40 (Diasymreader.dll CLASSNOTREG)
- Attempted to install several windows updates including August 2018 security & quality rollup - The Windows Server 2008 R2 SP1 (64 bit) operating system running the published applications appears upto date.
- Attempted different screen resolutions, colour depths on the end point / client machine
- Attempted setting various compatibility modes for our executable on the server, disabled high DPI, direct composition etc
- Attempted both x64 & x86 release builds with debug flags disabled - no PDBs
- Added checks to ensure our application is running in an elevated administrator contenxt
- Attempted useLegacyV2RuntimeActivationPolicy='true' within app.config configuration/startup element
- Attempted runtime/loadFromRemoteSources element within app.config element
- Ensured app.manifest exists to work correctly with UAC
- Checked local security policies on the server (I can't see any obvious issues)
- Attempted embedded WebView2 run-time (both x64 & x86)
- Attempted install & downloadd of the dedicated WebView2 run-time from https://developer.microsoft.com/en-us/microsoft-edge/webview2/ (both x86 & x64 versions)
- Installed latest version of Edge on the server running the published application
- Added msedge.exe,msedgewebview2.exe,msedgewebview2 to each of the following registry keys to disable Citrix hooks...
- HKEY_LOCAL_MACHINESOFTWARECitrixCtxHookExcludedImageNames
- HKEY_LOCAL_MACHINESOFTWAREWow6432NodeCitrixCtxHook64ExcludedImageNames
- HKEY_LOCAL_MACHINESYSTEMCurrentControlSetservicesCtxUviUviProcessExcludes
Key Differences
When launching our application as a published application via the Citrix Receiver portal as opposed to a regular desktop application, we see the following key differences via ProcMon...
- We see calls into the registry to locate the following CLSIDs (we don't see these calls when launched via a regular desktop app)...
60A417CA-F1AB-4307-801B-F96003F8938B - Host Object Helper
9BA05972-F6A8-11CF-A442-00A0C90A8F39 - Shell Folder View Router
0A29FF9E-7F9C-4437-8B11-F424491E3931 - NDP SymBinder CorSymBinder_SxS / Dia based SymReader (diasymreader.dl / mscoree.dll)l
FAE3D380-FEA4-4623-8C75-C6B61110B681Instance - WindowsCodecs.dll
- 0E25DC18-9F5E-48B1-80B3-D124E81B773B ColourTransformer (%SystemRoot%system32windowscodecsext.dll)
- 05AF94D8-7174-4CD2-BE4A-4124B80EE4B8
- 7835EAE8-BF14-49D1-93CE-533A407B2248
- 7ED96837-96F0-4812-B211-F13C24117ED3
- ABE3B9A4-257D-4B97-BD1A-294AF496222E
- AC757296-3522-4E11-9862-C17BE5A1767E
- I've verified the DLLs referenced to in the above CLSIDs are present within System32 & SysWOW64
- We see the PDB symbol reader at C:WindowsMicrosoft.NETFramework64v4.0.30319diasymreader.dll being loaded.
- Before any file is accessed we see calls into the registry at HKU.DefaultSoftwareCitrixSessionSfr10
- Our application runs under the WFICA32.EXE process on the end point which is a 32-bit process. We see our application launch on the server as a regular 64-bit process running under a domain user who belongs to the local administraots group.
Notes
- Whilst we have full admin privledges and our winforms application is running under the context of a local administrator the Windows Server 2008 R2 SP1 server hosting the published application is on a domain and various group policies are applied.
- Windows Firewall is completely disabled on the Windows Server 2008 R2 SP1 server hosting the published application
Webview Winforms
At this stage I'm at a loss as to know what to try next. I would sincerely welcome any suggestions from the Citrix experts here within the community.
Ensurecorewebview2async
Thank you in advance for any suggestions or assistance you can provide.
Best wishes for now,
C# Webview2 Winforms
Ryan