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;
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
The C# line below generates an error:
Excel.Worksheet wks = (Excel.Worksheet)wbk.Worksheets.Add(After: wbk.Worksheets.Count);
I intend for the code to create a new worksheet in the workbook wbk, but no new worksheet is created. Instead I get an error.
The error message I receive is:
A first chance exception of type
'System.Runtime.InteropServices.COMException' occurred in
Microsoft.Office.Interop.Excel.dll
How do I learn more about this error so that I can resolve it?
View detail tells me nothing that makes sense to me. Check the error code property of the exception to determine the HRESULT returned by the COM object tells me nothing that makes sense to me.
I don't know how to move forward with error searching from here.
What property or method call exactly fires the exception?
I'd recommend breaking the chain of calls and declaring each property or method on a separate line of code. Thus, you will be able to find the exact one which fires the exception.
Also try to specify optional parameters explicitly:
Excel.Worksheet wks = (Excel.Worksheet)wbk.Worksheets.Add(Type.Missing, wbk.Worksheets[1], Type.Missing, Type.Missing);
Pay attention to the fact that you need to specify the sheet after which the new sheet is added, not a number!
The error message:
A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in Microsoft.Office.Interop.Excel.dll
Is just a notification from a handled exception, you should have a try catch surround your call:
Excel.Worksheet wks = (Excel.Worksheet)wbk.Worksheets.Add(After: wbk.Worksheets.Count);
Try intercept the real exception.
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))
{
}
Is there a way to persist CS-Script internal assembly cache between subsequent application's runs?
Used component: http://www.csscript.net/
The desired behavior is:
when I compile an assembly form a script string and I close the application, the next time I run the application the compiled assembly with matching script string is found and no recompilation is needed.
This question is follow-up of another question:
Is there a way to call C# script files with better performance results?
Here is my code, but every script string requires recompilation with every restart of parent .NET application.
public interface ICalculateScript
{
Exception Calculate(QSift qsift, QSExamParams exam);
}
...
void Calculate(string script)
{
CSScript.CacheEnabled = true;
//Can following command use built-in cache to load assembly, compiled by this line of code, but by another instance of this app which run in the past and has been meanwhile closed?
Assembly assembly = = CSScript.LoadCode(script, null);
AsmHelper asmHelper = new AsmHelper(assembly);
ICalculateScript calcScript = (ICalculateScript)asmHelper.CreateObject("Script");
calcScript.Calculate(this, exam);
}
Related problem:
The folder of temp scripts created by Cache in CS Script C:\Users\vdohnal\AppData\Local\Temp\CSSCRIPT\Cache\2015108000 has 41 MB and growing with files few months old.
In the output window of WPF App there are first chance exceptions:
A first chance exception of type 'System.IO.FileLoadException' occurred in mscorlib.dll
A first chance exception of type 'System.IO.FileLoadException' occurred in mscorlib.dll
A first chance exception of type 'System.IO.FileLoadException' occurred in mscorlib.dll
A first chance exception of type 'System.IO.FileLoadException' occurred in mscorlib.dll
A first chance exception of type 'System.IO.FileLoadException' occurred in mscorlib.dll
'ESClient.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\vdohnal\AppData\Local\Temp\CSSCRIPT\Cache\2015108000\af621e10-d711-40d7-9b77-0a8e7de28831.tmp.compiled'
C:\Users\vdohnal\AppData\Local\Temp\CSSCRIPT\Cache\2015108000
I got an answer fom Oleg Shilo which pointed me in the right direction:
The cache folder indeed grows as new scripts are compiled/loaded. This
is the nature of the caching. It seems that it "grows without control"
though it is not. Once cache is created for a given script file it is
never duplicated and the new cache update is always written over the
existing one.
The problem in your case is that every time you load the file you give
it a unique name thus you are creating a new unique cache. To fix it
you need to start using the same name for the script file every time
you load/execute it.
Alternatively you can completely take over the caching location and
specify what ever cache name you want. It is that second parameter
that you pass null for:
Assembly assembly = CSScript.LoadCode(script, null);
I used following code:
if (assemblyFileName == null)
assembly = CSScript.LoadCode(script, null); //In case there is no name specified - when my custom temp folder cannot be created etc.
else
assembly = CSScript.LoadCode(script, assemblyFileName, false, null); //Specify full path and file name with extension
Thanks to this I have complete control over cached assembly name and location.
If cached assembly with appropriate script already exists, I can simply load it instead of compiling a new one:
Assembly assembly = Assembly.LoadFrom(assemblyFileName);
AsmHelper asmHelper = new AsmHelper(assembly)
The speed of initial loading is better and there is no uncontrollably growing cache.
Is there any possibility to commit a value of a variable (declared as string) on a SelectedItem of a ComboBox in a Coded UI Test?
for instance:
private const string SALUTATION = "Mr.";
...
CommonMap.SalutationParams.LstEntriesSelectedItemsAsString = SALUTATION;
CommonMap.Salutation();
...
I am getting an error because of trying this:
Result Message:
Test method CodedUIClassicCommon.Common.CodedUITestsCommon.CodedUIClassicCommonNeuerBenutzerWeiblich threw exception:
Microsoft.VisualStudio.TestTools.UITest.Extension.PlaybackFailureException: Cannot perform 'SetProperty of SelectedItemsAsString with value "A.Frau/SgF"' on the control. Additional Details:
TechnologyName: 'MSAA'
ControlType: 'List'
---> System.Runtime.InteropServices.COMException: Exception from HRESULT: 0xF004F008
TestCleanup method CodedUIClassicCommon.Common.CodedUITestsCommon.MyTestCleanUp threw exception. Microsoft.VisualStudio.TestTools.UITest.Extension.FailedToPerformActionOnHiddenControlException: Microsoft.VisualStudio.TestTools.UITest.Extension.FailedToPerformActionOnHiddenControlException: Cannot perform 'Click' on the hidden control. Additional Details:
TechnologyName: 'MSAA'
Name: 'Neu Ctrl+N'
ControlType: 'MenuItem'
---> System.Runtime.InteropServices.COMException: Exception from HRESULT: 0xF004F002.
I have searched in google for such a problem but i couldn't resolve it.
thanks for any help.
eric
Should
CommonMap.SalutationParams.LstEntriesSelectedItemsAsString = SALUTATION;
Have a dot between the LstEntries and SelectedItemsAsString?
CommonMap.SalutationParams.LstEntries.SelectedItemsAsString = SALUTATION;
Can you confirm that the object you are trying to click on is in fact visible? If you are clicking on a MenuItem that is hidden because the list needs to be expanded/scrolled/etc it will throw an error. This would be my first thought.
Also, I prefer to use the PerformSelect of the MenuItem rather than reassigning the value.