I'm trying my application, but an error comes up saying 'XamlParseException was unhandled". This is what is showing in the error window:
Cannot create instance of 'Shell' defined in assembly 'myProgram, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Exception has been thrown by the target of an invocation. Error in markup file 'myProgram;component/Shell.xaml' Line 1 Position 9.
Here's my line 1 in Shell.xaml:
"Window x:Class="myProgram.Shell"
Check your Shell.xaml. Looks like some XAML is breaking there. Check below things:
1) All bindings are ok.
2) Styles used are ok and present in style
3) any converter used are ok.
Related
I've been using this tutorial many times before and had never a issue. Since I updated my visual studio i get this.
I get the follow error after following this tutorial: https://devblogs.microsoft.com/dotnet/porting-desktop-apps-to-net-core/
I'm using the Guna.dll for my text and buttons.
Can anyone help me, give me more information about the problem/error?
System.TypeInitializationException
HResult=0x80131534
Message=The type initializer for 'A.c5596ad7eebefb7cfe22f22c88ed940ca' threw an exception.
Source=Guna.UI
StackTrace:
at A.c5596ad7eebefb7cfe22f22c88ed940ca.c28713f1a30f3f2105e30cc9d10f7ef4a()
at Guna.UI.WinForms.GunaLabel..ctor()
at Nettoya.FormHome.InitializeComponent() in C:\Users\b\Desktop\Nettoya\Nettoya\Form1.Designer.cs:line 37
at Nettoya.FormHome..ctor() in C:\Users\b\Desktop\Nettoya\Nettoya\Form1.cs:line 49
at Nettoya.Program.Main() in C:\Users\b\Desktop\Nettoya\Nettoya\Program.cs:line 18
Inner Exception 1:
TypeLoadException: Could not load type 'Microsoft.VisualBasic.Devices.Network' from assembly 'Microsoft.VisualBasic, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Getting following exception when loading :
speechRecognizer = new Microsoft.CognitiveServices.Speech.SpeechRecognizer(config);
Inner exception : InnerException = {"Unable to load DLL
'Microsoft.CognitiveServices.Speech.csharp.bindings.dll': The
specified module could not be found. (Exception from HRESULT:
0x8007007E)"}
Microsoft.CognitiveServices.Speech.Internal.carbon_csharpPINVOKE.SpeechConfig_FromSubscription(String
jarg1, String jarg2) at
Microsoft.CognitiveServices.Speech.Internal.SpeechConfig.FromSubscription(String
subscription, String region) at
Microsoft.CognitiveServices.Speech.SpeechConfig.FromSubscription(String
subscriptionKey, String region) |ERROR|The type initializer for
'SWIGExceptionHelper' threw an exception. 2019-01-03
16:02:50.2178|ERROR|The type initializer for
'Microsoft.CognitiveServices.Speech.Internal.carbon_csharpPINVOKE'
threw an exception.
As the exception says, you are missing "Microsoft.CognitiveServices.Speech.csharp.bindings.dll" . You have to include the dll in the project and mark it as part of the deploy. Make sure it appears in the deployed folder in the IIS , copy it manually as last option.
This question already has an answer here:
Error in binding resource string with a view in WPF
(1 answer)
Closed 7 years ago.
I have a WPF program, and when I localize it, it fails. I created this XML namespace, which corresponds to the file location, in the Window element:
xmlns:properties="clr-namespace:ResxEditor.Properties"
This is how I am localizing each element:
<Button Content="{x:Static properties:Resources.FilePickerButton_AddFile}" />
The designer works perfectly fine, and I when I choose Resources., auto-complete pulls up the available items, but when I build my application, it crashes with this error message:
Exception thrown: 'System.Windows.Markup.XamlParseException' in PresentationFramework.dll
Additional information: 'Provide value on 'System.Windows.Markup.StaticExtension' threw an exception.' Line number '5' and line position '9'.
The line number and position correspond to the first x in the namespace I have given above. I tried searching this message on the web, and I can't seem to find anything.
After an hour or so of searching the web, I randomly happened to try changing the access modifier on my Resources.resx file from internal to public. To do so, open your .resx file in the Visual Studio editor, and change the drop-down menu labeled "Access Modifier" to "public", which should be the only other option besides "internal".
This will change all the items in the .designer file to use the public access modifier. An example of these items looks like:
/// <summary>
/// Looks up a localized string similar to Add Files.
/// </summary>
public static string FilePickerButton_AddFile {
get {
return ResourceManager.GetString("FilePickerButton_AddFile", resourceCulture);
}
}
I have a C# application and I modified it to show a new window using the lines:
private void button1_Click(object sender, EventArgs e)
{
WelcomeScreen channelBar = new WelcomeScreen(true, "http://www.trade-ideas.com/cms_static/ChannelBar/channelbar.html");
}
It compiles just fine, but when I run the app and click on the button, I get this error:
An unhandled exception of type 'System.TypeLoadException' occurred in WindowsFormsApplication1.exe
Additional information: Could not load type 'TradeIdeas.TIProData.OddsMakerColumnConfiguration' from assembly 'TIProData, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
What doesn't make any sense is that WelcomeScreen comes from TIProGUI.dll not TIProData. I have included both dll's in the project along with a 3rd dll:
using TradeIdeas.TIProData;
using TradeIdeas.TIProGUI;
using TradeIdeas.TIProData.Configuration;
Also, when I run the project initially, I see a very strange message. It says:
Loading symbols from TIProData.dll from:
\\MissionControl\Users\KLewis2\Documents\CVSRoot\C_Sharp\TIProData\Obj\Release
Needless to say, there is no path to that from my machine.
Any clues as to what is causing this would be greatly appreciated.
There are many reasons and one of common once is exceptions in static initializers.
To diagnose - debug program with exceptions set to "break when thrown" and disabled "my code only". When exception happen take note of call stack and check all exceptions thrown from static initializers.
Location of options:
Tools-> Options -> Debug -> My Code only (uncheck)
Debug -> Exceptions -> Common Language Runtime Exceptions (check "thrown")
Sample code that will cause that error:
class MyClass
{
static int value = ReadFromConifg();
static int ReadFromConifg()
{...
throw new ConfigMissingException();
}
}
I have sucessfully built the example AddressBook project in protobuf-csharp-port-2.4.1.473-source and have even got it to work with the C++ example from the protobuf-2.4.1-win32. However, when I try to regenerate the AddressBookProtos.cs file and execute it, I encounter the following runtime problem.
Options:
L: List contents
A: Add new person
Q: Quit
Action? a
Exception executing action: System.TypeInitializationException: The type initializer
for 'Google.ProtocolBuffers.Examples.AddressBook.AddressBook' threw an exception. --->
System.TypeInitializationException: The type initializer
for 'Google.ProtocolBuffers.Examples.AddressBook.AddressBookProtos' threw an exception. --->
System.ArgumentException: Invalid embedded descriptor for "tutorial/addressbook.proto". --->
Google.ProtocolBuffers.Descriptors.DescriptorValidationException: tutorial/addressbook.proto:
Dependencies passed to FileDescriptor.BuildFrom() don't match those listed in the
FileDescriptorProto.
at Google.ProtocolBuffers.Descriptors.FileDescriptor.BuildFrom(FileDescriptorProto proto,
FileDescriptor[] dependencies)
at Google.ProtocolBuffers.Descriptors.FileDescriptor.InternalBuildGeneratedFileFrom(Byte[]
descriptorData, FileDescriptor[] dependencies, InternalDescriptorAssigner descriptorAssigner)
I tried to generate the AddressBookProtos.cs from protobuf-csharp-port-2.4.1.473-release-binaries, using protos\tutorial\addressbook.proto but it seems to be missing the namespace and umbrella_classname options. Also, the version numbers listed in src\AddressBook\AddressBookProtos.cs that came in protobuf-csharp-port-2.4.1.473-source says it is "2.3.0.277".