Comments (4)
System.Runtime.InteropServices.COMException
HResult=0x80004004
Message=已中止操作 (异常来自 HRESULT:0x80004004 (E_ABORT))
Source=mscorlib
StackTrace:
在 System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
在 Microsoft.Web.WebView2.Core.CoreWebView2Environment.d__98.MoveNext()
在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
在 System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
在 Microsoft.Web.WebView2.WinForms.WebView2.d__25.MoveNext()
在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
在 System.Runtime.CompilerServices.TaskAwaiter.GetResult()
在 MyCustomTaskPane.d__2.MoveNext() 在 D:\VisualStudio项目\EasyShu\WebView2Test\MyCustomTaskPane.cs 中: 第 28 行
此异常最初是在此调用堆栈中引发的:
[外部代码]
MyCustomTaskPane.InitializeWebView2() (位于 MyCustomTaskPane.cs 中)
from exceldna.
This is the code we use to instantiate the webView2
private static async Task<CoreWebView2Environment> WebView2EnvironmentAsync()
{
if (webView2Environment == null)
{
Environment.SetEnvironmentVariable("COREWEBVIEW2_FORCED_HOSTING_MODE", "COREWEBVIEW2_HOSTING_MODE_WINDOW_TO_VISUAL"); // https://github.com/MicrosoftEdge/WebView2Feedback/issues/951#issuecomment-1064624832
string localAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
string cacheFolder = Path.Combine(localAppData, "WindowsFormsWebView2");
LogDisplay.RecordLine($"Available Browser Version String is {CoreWebView2Environment.GetAvailableBrowserVersionString()}, cache folder is {cacheFolder}");
webView2Environment = await CoreWebView2Environment.CreateAsync(null, cacheFolder);
LogDisplay.RecordLine($"CoreWebView2Environment is {webView2Environment}");
}
return webView2Environment;
}
WebView2 webView21;
var environment = await WebView2EnvironmentAsync();
await webView21.EnsureCoreWebView2Async(environment);
from exceldna.
This is the code we use to instantiate the webView2
private static async Task<CoreWebView2Environment> WebView2EnvironmentAsync() { if (webView2Environment == null) { Environment.SetEnvironmentVariable("COREWEBVIEW2_FORCED_HOSTING_MODE", "COREWEBVIEW2_HOSTING_MODE_WINDOW_TO_VISUAL"); // https://github.com/MicrosoftEdge/WebView2Feedback/issues/951#issuecomment-1064624832 string localAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); string cacheFolder = Path.Combine(localAppData, "WindowsFormsWebView2"); LogDisplay.RecordLine($"Available Browser Version String is {CoreWebView2Environment.GetAvailableBrowserVersionString()}, cache folder is {cacheFolder}"); webView2Environment = await CoreWebView2Environment.CreateAsync(null, cacheFolder); LogDisplay.RecordLine($"CoreWebView2Environment is {webView2Environment}"); } return webView2Environment; }
WebView2 webView21; var environment = await WebView2EnvironmentAsync(); await webView21.EnsureCoreWebView2Async(environment);
I user the above code,but also fail ,my windows is win11,so Environment.SetEnvironmentVariable("COREWEBVIEW2_FORCED_HOSTING_MODE", "COREWEBVIEW2_HOSTING_MODE_WINDOW_TO_VISUAL"); is not necessary ,thanks anything
from exceldna.
I found out why. I didn't give MyCustomTaskPane a [ComVisible(true)] attribute. I made a stupid mistake, sorry
from exceldna.
Related Issues (20)
- Unable to build project with latest release HOT 1
- Registration [Error] xlfRegister call failed for function or command HOT 3
- Attack surface reduction block triggered in corporate environment HOT 1
- Could not load file or assembly 'System.Reflection.Metadata HOT 1
- Error value on multiple calls to a ThreadSafe async function HOT 7
- FrameworkReference issue with xll (.NET 6) HOT 3
- How much money is needed to make it .net 8 compatible? HOT 1
- How to access Microsoft.Office.Interop.Excel component from IRibbonControl HOT 2
- Use runtimeconfig.json when loading runtime - ASP.NET Core support under .NET 6+
- RunExcelDnaSetDebuggerOptions: open Excel file at launch HOT 2
- native runtime library is not found when packed. HOT 3
- Support packing a .chm help file
- option to disable machine hive (i.e. assume always non-elevated) + pre-register ribbon [in installer] HOT 4
- Expand CustomAttributes for paramarray parameters HOT 1
- suggested enhancement - flag to indicate to intellisensehelper whether the workbook provider is required
- Should ExcelAsyncUtil.QueueAsMacro (or something similar) return Task?
- Debugging fails when <ExcelDnaUnpack>true<ExcelDnaUnpack> is set
- ExcelDNA support independent deployment? HOT 2
- PackExcelAddIn error DNA-818471385 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from exceldna.