targetinvocationexception

EPPlus 2.9.0.1 throws System.IO.IsolatedStorage.IsolatedStorageException when trying to save a file bigger than ~1.5 MiB from a SSIS package

ⅰ亾dé卋堺 提交于 2020-06-24 12:54:07
问题 The problem When I try to save a file over ~1.5 MiB with EPPlus ExcelPackage.Save() throws a System.IO.IsolatedStorage.IsolatedStorageException . The explanation I'm creating a SSIS package with Visual Studio 2008 9.0.30729.4462 QFE and .NET Framework 3.5 SP1 to export the content of a SQL Server 2008 SP2 10.0.4311.0 64 bit table through the EPPlus 2.9.0.1 library. The SSIS package is really simple: an Execute SQL Task which reads the table's content and puts it in a variable followed by a

System.Reflection.TargetInvocationException: dynamically define constructor with parameters

旧城冷巷雨未停 提交于 2019-12-13 02:38:50
问题 We want to dynamically create a class, the constructor as below: public JsRF1013Wrapper(ScriptEngine scriptEngine, string jsFileFullPath) { this.ScriptEngine = scriptEngine; var jsFileContent = File.ReadAllText(jsFileFullPath); this.ScriptEngine.Execute(jsFileContent); } we got the IL: .method public hidebysig specialname rtspecialname instance void .ctor(class [ClearScript]Microsoft.ClearScript.ScriptEngine scriptEngine, string jsFileFullPath) cil managed { // Code size 37 (0x25) .maxstack 2

How are these two invocations different?

∥☆過路亽.° 提交于 2019-12-11 17:56:53
问题 I'm trying to modify a combo box on my WinForms application, and I'm getting some strange behavior. I'm trying two methods: Here is the method I need to invoke: private void modifyCombo(ClassInfoHolder oldClass, ClassInfoHolder newClass) { this.monitoredComboBox.Items[monitoredComboBox.Items.IndexOf(oldClass)] = newClass; } I'm trying two different ways to invoke this method from the GUI thread. This one works: delegate void modifyComboCollection(ClassInfoHolder oldClass, ClassInfoHolder

TargetInvocationException from BackgroundWorker_RunWorkerCompleted

扶醉桌前 提交于 2019-12-10 22:17:29
问题 Suppose the following situation. A form has a button that on click starts a background worker. In RunWorkerCompleted event handler there is a piece of code that throws unhandeled exception. The form is started from Application.Run method. public partial class FormMain : Form { public FormMain() { InitializeComponent(); } private void backgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { throw new Exception(); } private void button_Click(object sender, EventArgs e

TargetInvocationException on Image update in WPF

百般思念 提交于 2019-12-10 21:51:19
问题 I've built a WPF Control which displays an Image. Now I would like to change that image at a very fast rate. I've build an ImageContainer class which holds the image and has a ChangedEventHandler which updates the Image in my control when changed. The code which is executed looks like this: videoImageThread = new Thread( new ThreadStart( delegate() { this.VideoCapture.Dispatcher.Invoke( System.Windows.Threading.DispatcherPriority.Normal, new Action( delegate() { videoImage.Source =

log4Net issues with NUnit (Tried v2.5.7, 2.5.2, 2.4.8, 2.4.7)

流过昼夜 提交于 2019-12-01 20:18:51
问题 I'm getting an error (see bottom of post) when running NUnit against a production code assembly. The production code assembly has a reference to a third party framework that uses log4net internally (Specifically, this is SimplyAccounting's SDK). The version of log4net that it uses is 1.2.9.0. Outside of this third party framework which we use via the public api from the dll files, log4net is not part of our production code. While troubleshooting, I eliminated the reference to the production

log4Net issues with NUnit (Tried v2.5.7, 2.5.2, 2.4.8, 2.4.7)

人盡茶涼 提交于 2019-12-01 19:56:51
I'm getting an error (see bottom of post) when running NUnit against a production code assembly. The production code assembly has a reference to a third party framework that uses log4net internally (Specifically, this is SimplyAccounting's SDK). The version of log4net that it uses is 1.2.9.0. Outside of this third party framework which we use via the public api from the dll files, log4net is not part of our production code. While troubleshooting, I eliminated the reference to the production code assembly from the unit test project and added a reference to the SimplyAccounting SDK. When I do

How to rethrow the inner exception of a TargetInvocationException without losing the stack trace

南笙酒味 提交于 2019-11-27 20:34:38
I have many methods which are calling using Delegate.DynamicInvoke . Some of these methods make database calls and I would like to have the ability to catch a SqlException and not catch the TargetInvocationException and hunt through its inners to find what's actually gone wrong. I was using this method to rethrow but it clears the stack trace: try { return myDelegate.DynamicInvoke(args); } catch(TargetInvocationException ex) { Func<TargetInvocationException, Exception> getInner = null; getInner = delegate(TargetInvocationException e) { if (e.InnerException is TargetInvocationException) return

How to rethrow the inner exception of a TargetInvocationException without losing the stack trace

邮差的信 提交于 2019-11-26 20:25:57
问题 I have many methods which are calling using Delegate.DynamicInvoke . Some of these methods make database calls and I would like to have the ability to catch a SqlException and not catch the TargetInvocationException and hunt through its inners to find what's actually gone wrong. I was using this method to rethrow but it clears the stack trace: try { return myDelegate.DynamicInvoke(args); } catch(TargetInvocationException ex) { Func<TargetInvocationException, Exception> getInner = null;

Why is TargetInvocationException treated as uncaught by the IDE?

旧巷老猫 提交于 2019-11-26 14:29:02
问题 I have some code that is using reflection to pull property values from an object. In some cases the properties may throw exceptions, because they have null references, etc. object result; try { result = propertyInfo.GetValue(target, null); } catch (TargetInvocationException ex) { result = ex.InnerException.Message; } catch (Exception ex) { result = ex.Message; } Ultimately the code works correctly, however when I am running under the debugger: When the property throws an exception, the IDE