C# Compile Issue - c#

An unhandled exception of type 'System.TypeInitializationException' occurred in Microsoft.VisualStudio.HostingProcess.Utilities.dll
Additional information: The type initializer for 'BobTyler.Program' threw an exception.
'BobTyler.vshost.exe' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll'
Any advice? Thanks.

My guess is that you´ve got a configuration setting in your BobTyler.exe.config (/app.config in the solution project) that isn't of a proper type. Check all entries under and make sure that they´re mapped to proper types.

Related

C# Entity Framework "An unhandled exception of type 'System.Reflection.TargetInvocationException' occurred in EntityFramework.dll"

I'm building a simple login form using VS2015, C#, SQLite DB and entity Framework (under .net framework 4)
when I enter a valid user and password I get this exception
An unhandled exception of type 'System.Reflection.TargetInvocationException' occurred in EntityFramework.dll
Additional information: Exception has been thrown by the target of an invocation.
this is my DB :
http://www11.0zz0.com/2016/09/03/23/934209903.png
this is my User Class :
http://www11.0zz0.com/2016/09/03/23/937963117.png
this is the exception :
http://www11.0zz0.com/2016/09/03/23/381133631.pnghttp://www11.0zz0.com/2016/09/03/23/355831822.png
I tried everything i know .. but i did not succeeded
Does any one know how to solve this problem ?
Finally I found the problem. The type BOOLEAN in SQLite is not very compatible with C# type 'bool' ... I have changed it to int instead and it worked as magic.
Thank you mr robor78

UnityContainer.Resolve crashes when .NET Native tool chain is enabled

We have a Windows 10 UWP app that runs fine under Debug builds and crashes under Release builds. What it is about release builds that makes it crash is that .NET Native tools chain is enabled - disabling that allows the app to run. But that's not a real fix as it needs to run with .NET Native tool chain if you intend to publish to the store.
We use Microsoft.Practices.Unity for DI. Here's an example of how we register some classes:
container.RegisterType<IBoardView, BoardView>();
And then, in our app we resolve it as follows:
container.Resolve<IBoardView>();
It works fine unless I run it with .NET Native, in which case I get the following exception:
An exception of type 'Microsoft.Practices.Unity.ResolutionFailedException' occurred in Microsoft.Practices.Unity.dll but was not handled in user code
Additional information: Resolution of the dependency failed, type = "WindowsUniversal.ViewModels.Interfaces.IBoardViewModel", name = "(none)".
Exception occurred while: while resolving.
And in the output window I get:
Exception thrown: 'System.NullReferenceException' in System.Linq.Expressions.dll
Exception thrown: 'System.NullReferenceException' in Microsoft.Practices.Unity.dll
Exception thrown: 'Microsoft.Practices.Unity.ResolutionFailedException' in Microsoft.Practices.Unity.dll
An exception of type 'Microsoft.Practices.Unity.ResolutionFailedException' occurred in Microsoft.Practices.Unity.dll but was not handled in user code
Additional information: Resolution of the dependency failed, type = "WindowsUniversal.ViewModels.Interfaces.IBoardViewModel", name = "(none)".
Exception occurred while: while resolving.
Exception is: NullReferenceException - Object reference not set to an instance of an object.
At the time of the exception, the container was:
Resolving WindowsUniversal.ViewModels.Interfaces.IBoardViewModel,(none)
All this works under Debug or Release when .NET Native is disabled. Now I know .NET Native has it's limitations, reflection being one of them. I guess I'm asking how to get around this?
Any insights would be greatly appreciated, thanks.

Matlab builder NE 2012A x64 migreting to 2014B X64

I'm trying to convert my system from matlab 2012a x64 to matlab 2014b x64. However I'm getting this error. i'm using .Net 4.5, visual studio 2012 + update 5.
A first chance exception of type 'System.Exception' occurred in MWArray.dll
Additional information: Start-up options discovered in multiple assembiles.
then I hit F5 and I get:
A first chance exception of type 'System.TypeInitializationException' occurred in MWArray.dll
Additional information: The type initializer for 'MathWorks.MATLAB.NET.Utility.MWMCR' threw an exception.
I press F5 again and I get:
A first chance exception of type 'System.TypeInitializationException' occurred in MWArray.dll
Additional information: The type initializer for 'MathWorks.MATLAB.NET.Arrays.MWArray' threw an exception.
here is my code:
private static MWArray ConvertBlackLevelResultsToMWArray(BlackLevelData blackLevelData)
{
var blackLevelResultsGroupedbyExposure = from blResult in blackLevelData group blResult by blResult.ExposureTime;
var exposuresCount = blackLevelResultsGroupedbyExposure.Count();
var blackLevelCells = new MWCellArray(1, exposuresCount); //the exception is here
I have used .net reflector in order to go over all of the dependencies in other DLL files, they all have refernce to the correct MWarray version 2.14.1.0
Can you suggest A way to find out what is my problem?
thanks
You must remove all the attributes
[assembly: MathWorks.MATLAB.NET.Utility.MWMCROption ("- nojit")]
from all places, to which were added for MCR 2012a.

'Emgu.CV.Capture' does not contain a definition for 'GrabProcessState'

I work with EmguCV 2.9.0.1922 (x86, x64) and try to play a video file. I took one of Emgu-video-example from internet (EmguCV 2.4.2...) and can't even compile it: 'Emgu.CV.Capture' does not contain a definition for GrabProcessState. (Does Emgu.CV.dll crucially change between version 2.4 and 2.9??)
In the case I go to the EmguCV 2.4.2 compilation is OK, but runtime error is:
"A first chance exception of type System.DllNotFoundException occurred in Emgu.CV.dll
A first chance exception of type System.TypeInitializationException occurred in Emgu.CV.dll
An unhandled exception of type System.TypeInitializationException occurred in Emgu.CV.dll
Additional information: The type initializer for Emgu.CV.CvInvoke threw an exception."

The type initializer for 'Microsoft.VisualStudio.Tools.Office.Runtime.Security.UserInclusionList' threw an exception

In VSTO (Visual studio to Office) project I am getting following exception:
Error:
type initializer for
'Microsoft.VisualStudio.Tools.Office.Runtime.Security.UserInclusionList'
threw an exception
What does it mean and how do I resolve this error?
You have to enable the Inclusion List to Trust Office Application Customization. Follow Enabling the Inclusion list here.

Categories

Resources