I am having one C# code which is working fine. I made PS script of same functionality which is not working.
$config = New-Object MyClass
Error it is throwing is
Type initializer for MyClass2 threw an exception.
Type initializer error is coming from other class(MyClass2) object which is strange.
I checked inner exception that says
Could not load file or assembly or one of its dependencies.
But all of assemblies are loaded.
P.S. - I made a console application in .net and tried to make MyClass object with all same assemblies which i used in PS script. In this application works perfectly fine.
P.S. - Same PS script is working in VS2015, if i make PS project and run script through VS2015.