Hi I'm building a Windows 10 app and I'm using NodaTime 2.4.0 to handle some timezone scenarios. Whilst on debug mode it's working fine, this peace of code throws an "Aggregate Exception" with not much detail.
private void SetDateTime()
{
_currentTimeZone = DateTimeZoneProviders.Tzdb.GetSystemDefault();
}
Which yields the exception:
+ [0] {System.IO.FileNotFoundException: The system cannot find the file specified. (Excep_FromHResult 0x80070002)} System.Exception {System.IO.FileNotFoundException}
I'm compiling the app on Release using .net Native an targeting 10240. Any ideas why it's happening? thanks!
Related
I have a problem that an instance of an AggregateException causes a TargetInvocationException after a couple of accesses to an Icon resource.
I broke down the problem to the following steps to reproduce (.Net 4.0 full or client profile):
Create a new WinForms application (a console application will not work)
Add an arbitrary icon (.ico file) to the resources
Add the following code to the constructor:
new AggregateException();
for (var i = 0; ; ++i)
{
var icon = Resources.Certificate;
}
You have to change the resource name to the name of your resource.
That's all. Yes I know that this sample doesn't make sense. It's just to illustrate the problem. My working code is much more complex and all of this code is needed.
Without creating this excection the application will work forewer. But if this exception is created the access to the resource will fail with a TargetInvocationException. The InnerException told me that the operation has been finished successfully(?!?!) having a two-line stack trace in System.Drawing.Icon (ctor + Initialize).
What can I do to prevent this problem?
EDIT
It seems to be a problem using Windows 7. A binary which fails on Win 7 will run correctly in Win 8.1.
I found the reason for that problem:
The following system configuration is needed to reproduce the issue:
Windows 7 German Edition
Microsoft .Net Framework 4.5.2 installed (yes I know my binary is compiled against .Net 4.0)
KB2901983 installed
Having a machine which only contains the .Net Framework without KB2901983 the program works fine. After installing KB2901983 the program fails for the same binary (no recompilation required).
I tried to uninstall KB2901983 but it doesn't help. If it was once installed the program will fail. I tested it on a clean Windows 7 German Edition.
I have a big problem which makes me cry everytime when I try to resolve it.
I have installed VisualStudio2012 Express and made project in .net 4.5 framework it is simple project which use QUARTZ library and has only 2 lines:
var cron = new Quartz.CronExpression("0 * 8-22 * * ?");
DateTimeOffset? nextFire = cron.GetNextValidTimeAfter(DateTime.Now);
I successfully have compiled application and it works fine. But one day I had to change framework from .net4.5 to .net 4.0 and when i did it VisualStudio throws errors in line
DateTimeOffset? nextFire = cron.GetNextValidTimeAfter(DateTime.Now);
Exception is:
"An unhandled exception of type 'System.AccessViolationException' occurred in WindowsFormsApplication6.exe
Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
I tried to change framework from net4.0 to .net4.5 because in .net4,5 application worked fine but it does not works! I can go back to .NET4.5 but application throws the same System.AccessViolationException.
Have Anyone know how to resolve this issue?
I was facing this same problem.Somehow my project configuration for build was set x86.
It was not giving me option to change it.I unloaded project and changed it in notepad.Build configuration was set as "AnyCPU" and things started working problem
I am trying to launch my directX/SharpDX app with DeviceCreationFlags.Debug but i am getting the following crash upon startup:
SharpDX.SharpDXException: HRESULT: [0x80004005], Module: [General], ApiCode: [E_FAIL/Unspecified error], Message: Unspecified error
at SharpDX.Result.CheckError()
at SharpDX.Direct3D11.Device.CreateDevice(Adapter adapter, DriverType driverType, DeviceCreationFlags flags, FeatureLevel[] featureLevels)
at SharpDX.Direct3D11.Device..ctor(Adapter adapter, DeviceCreationFlags flags, FeatureLevel[] featureLevels)
at SharpDX.Toolkit.Graphics.GraphicsDevice..ctor(GraphicsAdapter adapter, DeviceCreationFlags flags, FeatureLevel[] featureLevels)
at SharpDX.Toolkit.GamePlatform.CreateDevice(GraphicsDeviceInformation deviceInformation)
at SharpDX.Toolkit.GraphicsDeviceManager.CreateDevice(GraphicsDeviceInformation newInfo)
at SharpDX.Toolkit.GraphicsDeviceManager.ChangeOrCreateDevice(Boolean forceCreate)
at SharpDX.Toolkit.GraphicsDeviceManager.SharpDX.Toolkit.IGraphicsDeviceManager.CreateDevice()
at SharpDX.Toolkit.Game.InitializeBeforeRun()
at SharpDX.Toolkit.GameWindowDesktop.Run()
at SharpDX.Toolkit.GamePlatform.Run(GameContext gameContext)
at SharpDX.Toolkit.Game.Run(GameContext gameContext)
at wrapper.Program.Main(String[] args)
This is on Win7 32bit and i do have the June2010 DirextX SDK and Runtime installed as well as the Windows SDK for Windows 7.
btw, this question originated from this one: SharpDX crash when rendering h264 video using MediaFoundation
From the MSDN (page on D3D11_CREATE_DEVICE_FLAG):
D3D11_CREATE_DEVICE_DEBUG
Creates a device that supports the debug layer.
To use this flag, you must have D3D11*SDKLayers.dll installed; otherwise, device creation fails. To get D3D11_1SDKLayers.dll, install the SDK for Windows 8.
These files are not part of the June2010 SDK. You have to find them somewhere else (i.e. in the Windows 8 SDK, as suggested).
Alternative to installing the SDK is installing Visual Studio 2012 or newer. Its installation will install these debug libraries.
Similar problem was mentioned here: link => explanation 3
I'm attempting to use log4net to provide logging in a Windows CE/Windows Embedded project. However, when debugging the project I get the following exception
System.TypeLoadException occurred
Message="TypeLoadException"
StackTrace:
at log4net.LogManager.GetLogger(Assembly repositoryAssembly, String name)
at log4net.LogManager.GetLogger(Type type)
at Sis.SiLogCE.Broker.StartBroker..cctor()
at Sis.SiLogCE.Broker.EntryPoint.Program.Main()
from the following line:
private static readonly ILog log = LogManager.GetLogger(typeof(StartBroker));
At first, I thought I might have been using the wrong dll/an old dll so I downloaded the most recent version - I am using the log4net.dll from 1.2.12-bin-newkey and found in .net-cp 3.5.
I've looked though other examples and though the documentation and I can see no reason why I'm getting a type load exception here. I'm now pretty much out of ideas as to what couple be causing the exception.
Background information:
Application is to be deployed on Windows CE 6 and Windows Embedded/Windows Mobile 6 and 6/5 devices.
.net 3.5
.netcf
The following block shows loading the config for log4net from an XML file named "log4net.config".
string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().
GetModules()[0].FullyQualifiedName) + "log4net.config";
if (File.Exists(path))
{
XmlConfigurator.ConfigureAndWatch(new FileInfo(path));
}
EDITS:
Up until now, I've only tested on Wince 6.0 so I've just had a shot with Windows Mobile 6.5 - it's no different, the same exception is presented.
Are you using the binary release, or have you built from source ? I ask as this page mentions that Compact Framework 1.0 & 2.0 are not supported by the binary release, but are supported if built from the source release.
My app runs fine on my machine (of course/famous last words). However, when deploying it to another machine on the network, it won't even start up. I ran my EventLog utility on that machine and it told me this:
Type:Error
Source: .NET Runtime
Time Generated: 06/12/2012 15:35:12
Message: Application: duckbilledPlatypus.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.TypeInitialization
Exception
Stack:
at duckbilledPlatypus.PlatypusMainForm..ctor()
at duckbilledPlatypus.Program.Main()
So it's something in my main form's constructor that's the problem, apparently...which, I admit, is a little "busy":
InitializeComponent();
foreach (string arg in Environment.GetCommandLineArgs())
{
if (arg == "-DEBUG")
{
InDebugMode = true;
break;
}
}
SuspendLayout();
tsch = new ToolStripControlHost(dateTimePickerScheduleDate);
toolStripPlatypusMain.Items.Add(tsch);
CreateTableLayoutPanelAndChildren();
LimitPlatypusIDTextBoxesToOneChar();
ShareEventsAmongDynamicTextBoxes();
SetAllPlatypusDataControlsReadOnly();
ResumeLayout();
Does any of this look problematic? (it's all pretty standard stuff, except for the ToolStripControlHost).
Now as to the framework version: does the Event Log report the framework version used to create my app, or the framework version installed on the machine trying to run the app? If the former, and the latter does not have that framework installed, that's a problem, right?
So if that's potentially the problem, how do I determine which version of the .NET runtime is installed on that machine?
UPDATE
I don't know why this is, but I was able to see an err msg after running the app on the remote/deployment only when I right-click and select Run As (and ran as myself, as I don't have any "more special" privileges on that machine). When I did so, I got "Unable to find a version of the runtime to run this application."
If I simply 2-click the app, it dies without a whimper (no err msg).
View the
view the %WINDIR%\Microsoft.NET\Framework directory
to determine which versions of .NET are installed.
http://msdn.microsoft.com/en-us/library/y549e41e.aspx
Try running the Fusion Log Viewer on the problematic machine. It will provide details about binding failures.
http://msdn.microsoft.com/en-us/library/e74a18c4(v=vs.100).aspx
Make sure you run it as administrator. It silently fails if you do not.
UPDATE
Based on your error "Unable to find a version of the runtime to run this application.", I would suggest you don't have the same version of .NET installed on the box that your application targets. Did you verify the installed versions using the steps above?
Also see
.Net framework - "unable to find a version of the runtime to run this application"