Trying to recognise a set of images in a folder (using Puma .NET OCR library), the first image is recognised successfully, but after that I get an error:
An unhandled exception of type 'System.Runtime.InteropServices.COMException'
occurred in Puma.Net.dll
Additional information: <0x00000000>: ?????? ???.
I have a special class for recognition, and the error happens on this line:
Puma.Net.PumaPage inputFile = new Puma.Net.PumaPage(imagePath);
I found this link and this one, but they don't seem to help in my case.
Thank you
I found the answer by using 'using' statement
using(Puma.Net.PumaPage inputFile = new Puma.Net.PumaPage(imagePath))
{
}
Related
I'm having trouble using NetTopologySuite's GeoJsonReader to deserialize Feature objects. In particular, I'm receiving the following exception (which at first glance seems straightforward, so please read on):
An unhandled exception of type 'System.ArgumentException' occurred in Newtonsoft.Json.dll. Additional information: Expected token '{' not found.
Just doing a simple round-trip results in this exception:
public static string DoIt( Feature feature )
{
GeoJsonWriter writer = new GeoJsonWriter();
var geoJson = writer.Write(feature);
GeoJsonReader reader = new GeoJsonReader();
var deserializedFeature = reader.Read<Feature>(geoJson );
}
in this case, geoJson is pretty straightforward:
"{\"type\":\"Feature\",\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-104.50348159865847,40.891762392617345],[-104.50348672999991,40.891415817000279],[-104.50355999200002,40.887782408000135],[-104.5036332529998,40.884149000000093],[-104.50845260799991,40.884357883000121],[-104.51307160051412,40.884558081989375],[-104.51307160051412,40.891762392617345],[-104.50348159865847,40.891762392617345]]]},\"properties\":null}"
Please let me know what I'm doing wrong. By the way, I'm using NetTopologySuite 1.14, NetTopologySuite.IO.GeoJSON 1.14, & Json.Net 9.0.1.
this is actually a bug.
code fixed, see #120
I would like to move the currently executing assembly to the C drive. When I try the following code:
File.Move(Assembly.GetEntryAssembly().Location, #"c\");
it gives me an error:
An unhandled exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll
Can this be fixed?
You must provide a name for the destination file:
File.Move(Assembly.GetEntryAssembly().Location, #"c:\xxx\foo.exe");
(Write on the root of C: requires elevation)
I try to use Sikuli Integrator for C#.
I create new project in Visual Studio 2015, and I Install SikuliIntegrator.
After the installation JSikuliModule.jar, it will be part of my solution, together with some additional files. After that Properties to set “Copy to Output Directory” property to “Copy always” of JSikuliModule.jar
and then I try my code :
class Program
{
static void Main(string[] args)
{
String pattern = #"C:\\Users\\amin-\\Documents\\Visual Studio 2015\\Projects\\SikuliTest\\SikuliTest\\img\\logo.png";
SikuliAction.Click(pattern);
//if (SikuliAction.Exists(pattern).IsEmpty)
//{
// Console.WriteLine("Nope! It's gone...");
//}
//else
//{
// Console.WriteLine("Yep! It's there...");
//}
}
}
If I run the code, this is the errors shows :
An unhandled exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll Additional information: Access to the path 'C:\SikuliOutputLog.txt' is denied.
If I run the code as an administrator, this is the errors shows :
An unhandled exception of type 'System.Exception' occurred in SikuliModule.dl Additional information: ###FAILURE
Manually create a text file 'C:\SikuliOutputLog.txt' then run the code.
It works for me.
In Windows10 besides manually adding C:\SikuliOutputLog.txt you need also to make sure current user have the 'Write' control to this file.
I'm using the following code to open a file and then trying to write something to it:
public partial class MainWindow : Window
{
StreamWriter file = null;
public MainWindow()
{
InitializeComponent();
using (file = new StreamWriter("../data/floorPlane.txt", true))
{
file.WriteLine("x \t y \t z \t w \n");
}
}
}
But it always gives the following error:
A first chance exception of type
'System.Windows.Markup.XamlParseException' occurred in
PresentationFramework.dll
Additional information: 'The invocation of the constructor on type
'SkeletalViewer.MainWindow' that matches the specified binding
constraints threw an exception.
I'm totally new to c#. Maybe the question is kindof stupid.
Thanks,
First, check the inner exception to see what you are actually messing up. Then, if the answer is still not apparent, compare your code to the sample found at this MSDN article:
http://msdn.microsoft.com/en-us/library/vstudio/system.io.streamwriter
this exception is caught many times. You can press ctrl+alt+E to check all exception and than you can find real exception.
An exception of type 'System.Exception' occurred in PresentationFramework.dll but was not handled in user code
Additional information: The component 'System.Data.Entity.DynamicProxies.Product_05FB87F8C316B6DF15988BC9D5490B22CB7A8FD7DD4DBD1126E065199C01A696' does not have a resource identified by the URI '/CRUDusingWPF;component/product.xaml'.
I do not think you have given enough info for others to help you.
Are you trying to use a DataTemplate for a Product?
Try turning off proxy creation and see if that makes a difference.
context.Configuration.ProxyCreationEnabled = false;