I'm just adding internationalization to my next WPF application, and have followed the instructions here.
I then noticed that there would be a fair amount of duplication in the satellite DLL, so marked the images that won't be localized in the .csproj as
<Localizable>False</Localizable>
Unfortunately, one of my resources is used in a SplashScreen thus:
SplashScreen ss = new SplashScreen("Images/splash.png");
ss.Show(false);
And this throws an exception when the Show call is executed. Here's the exception output
A first chance exception of type 'System.IO.IOException' occurred in WindowsBase.dll
A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll
Step into: Stepping over method without symbols 'System.RuntimeType.CreateInstanceImpl'
A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll
Step into: Stepping over method without symbols 'MS.Internal.Xaml.Runtime.ClrObjectRuntime.CreateInstance'
A first chance exception of type 'System.Xaml.XamlObjectWriterException' occurred in System.Xaml.dll
Step into: Stepping over method without symbols 'System.Windows.Markup.WpfXamlLoader.Load'
A first chance exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll
Additional information: 'The invocation of the constructor on type 'MainWindow' that matches the specified binding constraints threw an exception.' Line number '4' and line position '9'.
When I remove the False line it works again.
Is there any way to load the resource I want, which is stored in test.unlocalizable.g.resources?
Related
I don`t know where to find it was!
Program was working properly, but once it happened
Private Sub InserPP_Load(sender As Object, e As EventArgs)HandlesMyBase.Load
'TODO: This line of code loads data into the 'DataSet2.plump' table. You can move, or remove it, as needed.
Me.PlumpTableAdapter.Fill(Me.DataSet2.plump)
End Sub
An unhandled exception of type System.Data.OleDb.OleDbException occurred in System.Data.dll
Additional information:
Could not find file 'F:\proj visual\test1\test1\bin\Debug\plump.accdb'.
I've been experiencing some odd issues with my application that I am not sure how to go about tracking down because it is so random. I was wondering if there may be any ideas based on the stack trace below.
Here is some quick bullet points:
Issue seems to be related to code in the View (.cshtml)
It RANDOMLY appears and it has something to do with the session cookie because if you try from another computer then it is no issue or if you clear your cache it is no issue
My GetUserByIdentifier is wrapped in a try{}catch{} which returns NULL if we enter the catch{}.. which should redirect to the login screen.
Could this be something internal causing the error message? This unhandled exception can even happen on my login.cshtml page which doesn't even have any code in the view.
The error message:
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index]
System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource) +72
System.SZArrayHelper.get_Item(Int32 index) +13816967
Nancy.ViewEngines.Razor.RazorViewEngine.GetLineNumber(Int32 startLineIndex, IReadOnlyList`1 compilationSource) +39
Nancy.ViewEngines.Razor.<>c__DisplayClass19_0.<BuildErrorMessages>b__0(Diagnostic error) +118
System.Linq.WhereSelectArrayIterator`2.MoveNext() +80
System.Linq.WhereEnumerableIterator`1.MoveNext() +51
System.Linq.Buffer`1..ctor(IEnumerable`1 source) +250
System.Linq.Enumerable.ToArray(IEnumerable`1 source) +106
Nancy.ViewEngines.Razor.RazorViewEngine.BuildErrorMessages(IEnumerable`1 errors, IList`1 templateLines, IReadOnlyList`1 compilationSource) +272
Nancy.ViewEngines.Razor.RazorViewEngine.BuildErrorMessage(EmitResult result, ViewLocationResult viewLocationResult, String sourceCode) +366
Nancy.ViewEngines.Razor.<>c__DisplayClass14_0.<GenerateRazorViewFactory>b__0() +49
Nancy.ViewEngines.Razor.RazorViewEngine.GetViewInstance(ViewLocationResult viewLocationResult, IRenderContext renderContext, Object model) +1064
Nancy.ViewEngines.Razor.<>c__DisplayClass9_0.<RenderView>b__0(Stream stream) +4700
Nancy.Hosting.Aspnet.<ProcessRequest>d__2.MoveNext() +381
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +13891908
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +61
System.Web.TaskAsyncHelper.EndTask(IAsyncResult ar) +69
System.Web.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar) +178
I have the following error message:
An unhandled exception of type 'System.IO.IOException' occurred in PresentationFramework.dll
Additional information: Cannot locate resource 'Sections/MainWindow.xaml'.
I created folder and then moved my MainWindow.xaml into the folder named Sections. I got the error and then found the question that is already on here about making sure that I change my starupURI to Sections/mainwindow.xaml
However I'm still getting the error message and I don't know why.
Edit: So i ran the code again, not making any changes and now I'm getting this
A first chance exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll
Additional information: 'Provide value on 'System.Windows.Baml2006.TypeConverterMarkupExtension' threw an exception.' Line number '5' and line position '54'.
The code that I have at that position:
<Window x:Class="CTaC_Information_System.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
WindowStartupLocation="CenterScreen"
Title="CTaC Information System" Height="828" Width="1486.5" Icon="AISLogov2.ico" Loaded="Window_Loaded" FontFamily="Georgia">
The red line is under the >. I went to the end of my code and added the </Window> because for some reason I was still getting the error message.
All help is greatly appreciated.
I think the second error is being caused by your icon. Try removing that bit of code and re-compiling to check if that isolates the problem. You could try changing the icon image to a .png rather than .ico.
For me this happen, when i moved classes MainWindows.xaml and App.xaml from root folder to /UI folder.
When i moved them back - all become normal again, error gone.
A first chance exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll
Additional information: 'The invocation of the constructor on type 'filehelpertest.MainWindow' that matches the specified binding constraints threw an exception.' Line number '3' and line position '9'.
Hi all,
i'v wanted to change my grid's cursor to a custom one using this code:
//using resources is already in the references assembly
Cursor gameCursor = new Cursor(Application.GetResourceStream(new Uri("pack://application:,,,/Pictures/Cursor.cur")).Stream);
MenuGrid.Cursor = gameCursor;
but for some reason this exception jumps when im running the program.
the .cur file has been added to the project and marked as a resource.
any ideas?
Popup
An unhandled exception of type 'System.IO.IOException' occurred in
PresentationFramework.dll
Additional information: Cannot locate resource 'mainwindow.xaml'.
Output Log
'markless.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'
...
'markless.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework\v4.0_4.0.0.0__31bf3856ad364e35\PresentationFramework.dll'
The thread 'vshost.NotifyLoad' (0x6b0) has exited with code 0 (0x0).
The thread 'vshost.LoadReference' (0x1fa8) has exited with code 0 (0x0).
'markless.vshost.exe' (Managed (v4.0.30319)): Loaded 'T:\#_\Programming\GitHub\markless\src\win2\markless\bin\Debug\markless.exe', Symbols loaded.
Step into: Stepping over method without symbols 'markless.App.App'
'markless.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll'
A first chance exception of type 'System.IO.IOException' occurred in PresentationFramework.dll
An unhandled exception of type 'System.IO.IOException' occurred in PresentationFramework.dll
Additional information: Cannot locate resource 'mainwindow.xaml'.
The program '[6268] markless.vshost.exe: Program Trace' has exited with code 0 (0x0).
The program '[6268] markless.vshost.exe: Managed (v4.0.30319)' has exited with code 0 (0x0).
This happens every time I try to add a C# class to my project. It's WPF, and when I start a new project, it'll run fine with just the window. The minute I try to add actual functionality to the application, it blows up on me like this. (Oh, it builds, it builds fair enough - this is a runtime error.) Even if I then remove the class, the application will still not run correctly. Wat do?
Any help is appreciated.
There are many ways of going forward, but only one way of standing still. - FDR
EDIT:
If you want to check out the repo, it's right here.
Additional information: Cannot locate resource 'mainwindow.xaml'.
Your App.xaml:
<Application x:Class="markless.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">
The problem is not the adding of any classes but the removal/renaming of the MainWindow which is still referenced here.