-
Notifications
You must be signed in to change notification settings - Fork 213
System.TypeInitializationException Message=The type initializer for 'WebWindows.WebWindow' threw an exception. #1
Comments
Did you select x64 as your target platform? As @SteveSandersonMS has mentioned in his blog post it will not compile with Any CPU, at least the native part. |
Interesting. I don't know why this would happen. Can anyone else confirm whether the |
It does work, however the WebWindow.Native needs to be built first, since it is a dependency. |
Same error, I am unable to get it working. I did
Edit Program.cs paste into var window = new WebWindow("My super app");
window.NavigateToString("<h1>Hello, world!</h1> This window is from a .NET Core app.");
window.WaitForExit();
OS Name Microsoft Windows 10 Enterprise |
Are you running an x86 version of .NET Core? |
Yes 64 bit |
OK, I don't know what the issue is then. If you find out, it would be great if you could let us know, especially if you also know how this can be fixed in the library. |
Adding more info. Just tried it on my home PC and same error.
OS Name Microsoft Windows 10 Pro |
@arpadbarta I didn't build the WebWindow project. I used the NuGet package for the samples solution. I'm home now and will try again on my home system. |
I had the same issue. I had to install MSVC v142 - VS2019 C++ x64/x86 build tools (v14.23) to get this to work. You can do this from VS 2019 Installer > Modify > Individual Components. |
@Code-DJ did you rebuild WebWindow or do you need the tools to build the Samples apps? |
@kdawg1406 I just created a test .NET Core Console app. Added the WebWindow package, put the following lines in Main:
Didn't try the sample apps but looks like we need the build tools even for your own sample/test apps. |
@Code-DJ thank you, I'm installing the build tools now. |
@Code-DJ @SteveSandersonMS I'm still getting the same exception after installing the build tools and creating a .NET Core Console app. I added the NuGet package as Code did. I built using x64.
[YOLO] Mon 11/18/2019 18:59:04.60 |
@SteveSandersonMS the date difference on these files is 2 months. Is there a chance one of them is incorrect? |
@kdawg1406 the dates are the same on my machine. Both Any CPU and x64 works for me. I think the x64 build requirements are for building the WebWindow.Native project not for projects that use it. Just to confirm:
|
OK, I tracked down the issue. It's because the windows DLL had been built in Debug mode, not Release mode. In Debug mode, it can only run if you have some VC++ DLLs on your machine (specifically, the Windows 10 SDK). I'm changing the prebuilt binary to be a Release build now so it won't require you to have extra stuff on the machine. |
@SteveSandersonMS you are the MAN! I'm doing a Lunch and Learn at work Wednesday and am JUICED to show off this work. You'll let us know when the NuGet package is updated? |
@Code-DJ that is exactly the steps I followed. No clue why it didn't work for me. This is great feedback for Steve, love Blazor! |
Got the latest package update that @SteveSandersonMS just pushed. Uninstalled the build tools. Verified that it works correctly. |
Great! The new version is 0.1.0-20191119.2 BTW. Closing now as fixed. Thanks for reporting it. |
@SteveSandersonMS now getting this exception with two of my projects: An unhandled exception of type 'System.AccessViolationException' occurred in WebWindow.dll Not sure what is going. |
@SteveSandersonMS this is what the Sample Vue app does on start up. |
@Code-DJ what version of .NET Core are you targetting. I'm targetting the .NET Core 3.0 RTM release. I'm using Visual Studio 2019 16.3.9 I've un-stalled the build tools. I wonder what the differences are between our systems??? |
@Code-DJ @SteveSandersonMS I just installed the Chrome Edge browser beta and it's now working! |
Just had the same problem as @kdawg1406, and the same fix (installing Edge beta) worked for me. Might be worth adding to the readme that the Edge beta needs to be installed on Windows. |
@distantcam I went back and re-read @SteveSandersonMS blog post. It's here, I missed it too, Chromium-based Edge is required on Windows. |
So it sounds like the chromium-based edge is not installed by default yet? I assumed that edge was chromium-based from it's inception? We might have to see about fast tracking the fallback feature if 95% of Windows boxes don't have it. |
I just published my Blazor Budget app using WebWidow. Thank you @SteveSandersonMS for writing this product! If you read my below readme, you'll notice what I had to do to get the 3rd Party NuGet package JavaScript files to load when the app is running in Visual Studio. The hack is not required when running from the publish directory. No biggie. https://github.com/Oceanware/BlazorBudgetWebWindow |
Sorry to write on a closed issue, but I'm trying this on a mac, targeting the new nuget package 0.1.0-20191119.2, and I'm getting the same error Edit: Some more info - all I did was as the blog post stated: new .net core 3 app, add reference, add code to program.main
|
@mika76 I'm not entirely familiar with the way nuget resolves dependencies and stuff, but I was getting the same error (also on Mac) and could narrow it down to not having the correct runtime folder under bin (I was getting win-x64 instead of a osx-x64). |
@alexphi yeah I just cloned and built the whole repo, and the only project which runs straight after a build is the HelloWorldApp in testassets, the other's just don't get the .dylib file (although they do get the WebWindow.dll file) - seems copying it over manually makes them work... |
So package |
@distantcam @mika76 Thanks for spotting this, and sorry for the inconvenience! This is fixed now - please try updating to the latest build |
Same problem here on multiple machines, my main dev machine it runs fine on. It even fails on a machine with Visual Studio Code and running from source code. Only latest version of the library: 0.1.0-20191120.6 Installing "Build Tools for Visual Studio 2019 (version 16.4)" on the machines helped and it works fine. Installed the "MSVC v142 - VS2019 C++ x64/x86 build tools (v14.23)" which is mentioned by @Code-DJ This must be fixed, perhaps the published package changed from release to debug again?
WebView: 0.1.0-20191120.6 |
When running any of the sample apps on Windows 10 I'm getting this exception:
System.TypeInitializationException
HResult=0x80131534
Message=The type initializer for 'WebWindows.WebWindow' threw an exception.
Source=WebWindow
StackTrace:
at WebWindows.WebWindow..ctor(String title)
at VueFileExplorer.Program.Main(String[] args) in C:\repos\Karl Personal\WebWindow\samples\VueFileExplorer\Program.cs:line 14
Inner Exception 1:
DllNotFoundException: Unable to load DLL 'WebWindow.Native' or one of its dependencies: The specified module could not be found. (0x8007007E)
Thank you for looking into this.
The text was updated successfully, but these errors were encountered: