exception

All unit tests throwing BadImageFormatException with Moq?

≯℡__Kan透↙ 提交于 2020-01-04 06:53:28
问题 I'm currently in the process of increasing code coverage on our software products and have ran into an issue; all of my unit tests (when compiled using 'Any CPU') are failing due to throwing a 'BadImageFormatException'. This exception can be circumvented by building the solution using 'x86' instead of 'Any CPU', however the requirements are such that we need to be able to run them using Any CPU/x64 bit. All unit tests involving Moq follow pretty much the same format: [TestMethod] public void

Nested LINQ Method throwing a `Not Supported…` Exception

落爺英雄遲暮 提交于 2020-01-04 06:47:05
问题 This is a follow up from here -->multiple-sorting-on-linq-nested-method . Basically, on let memberName = ... it is throwing this exception Method 'System.String MemberName(Int32)' has no supported translation to SQL. and I am not figuring out the solution. Also, BLLCmo and BLLConnect actually use TWO different DataBases . The original app(not mine) uses 4 Seperate DB's so I am trying to make due. BLLCmo.cs public static DataTable GetAllMembers(Guid workerID) { var AllEnrollees = from

Nested LINQ Method throwing a `Not Supported…` Exception

时光总嘲笑我的痴心妄想 提交于 2020-01-04 06:45:27
问题 This is a follow up from here -->multiple-sorting-on-linq-nested-method . Basically, on let memberName = ... it is throwing this exception Method 'System.String MemberName(Int32)' has no supported translation to SQL. and I am not figuring out the solution. Also, BLLCmo and BLLConnect actually use TWO different DataBases . The original app(not mine) uses 4 Seperate DB's so I am trying to make due. BLLCmo.cs public static DataTable GetAllMembers(Guid workerID) { var AllEnrollees = from

$.ajax error cannot catch thrown exception from php

一笑奈何 提交于 2020-01-04 06:33:07
问题 $.ajax({ type: "POST", url: "functions/add_vendor.php", data: { vendor_info_json : vendor_info_json }, success:function(result) { alert('Successfully Done.') location.reload(); }, error: function(jqXHR, textStatus, errorThrown){ alert('Error Message: '+ textStatus); alert('HTTP Error: '+ errorThrown); } }) This is the jquery code I'm working on. And the following is the add_vendor.php file being called. <?php include_once('../models/VENDOR_DB_MANAGER.php'); $vendor_info_json = $_REQUEST[

$.ajax error cannot catch thrown exception from php

爷,独闯天下 提交于 2020-01-04 06:32:11
问题 $.ajax({ type: "POST", url: "functions/add_vendor.php", data: { vendor_info_json : vendor_info_json }, success:function(result) { alert('Successfully Done.') location.reload(); }, error: function(jqXHR, textStatus, errorThrown){ alert('Error Message: '+ textStatus); alert('HTTP Error: '+ errorThrown); } }) This is the jquery code I'm working on. And the following is the add_vendor.php file being called. <?php include_once('../models/VENDOR_DB_MANAGER.php'); $vendor_info_json = $_REQUEST[

How to get the line number from a Stack Trace?

谁说胖子不能爱 提交于 2020-01-04 06:31:13
问题 I am trying to get the line number from a stack trace in my WP7 app. I have set debug info to full and am running the app in the Debug configuration, but there are no line numbers in stack traces. How can I fix this? I am aware of BugSense, but do not want to use it. 回答1: Don't think this is even possible, as line number refers to the number of the line inside code-file , which has lost any relation with the binary after compilation. That's why we use PDB files. They are "databases" for

How to refactor a function that throws exceptions?

主宰稳场 提交于 2020-01-04 06:08:36
问题 Suppose I am refactoring a function like this: def check(ox: Option[Int]): Unit = ox match { case None => throw new Exception("X is missing") case Some(x) if x < 0 => throw new Exception("X is negative") case _ => () } I'd like to get rid of the exceptions but I need to keep the check signature and behavior as is, so I'm factoring out a pure implementation -- doCheck : import scala.util.{Try, Success, Failure} def doCheck(ox: Option[Int]): Try[Unit] = ??? def check(ox: Option[Int]): Unit =

How to refactor a function that throws exceptions?

和自甴很熟 提交于 2020-01-04 06:08:28
问题 Suppose I am refactoring a function like this: def check(ox: Option[Int]): Unit = ox match { case None => throw new Exception("X is missing") case Some(x) if x < 0 => throw new Exception("X is negative") case _ => () } I'd like to get rid of the exceptions but I need to keep the check signature and behavior as is, so I'm factoring out a pure implementation -- doCheck : import scala.util.{Try, Success, Failure} def doCheck(ox: Option[Int]): Try[Unit] = ??? def check(ox: Option[Int]): Unit =

How to use custom Exception in Session Beans?

浪子不回头ぞ 提交于 2020-01-04 05:35:07
问题 EJB 3.1 Session Bean: import javax.ejb.*; public class FooException extends EJBException { } @Stateless @Local public class Foo { public void bar() throws FooException { if (/* something wrong */) { throw new FooException(); } } } Now the test: import org.junit.*; public class FooTest { @Test(expected = FooException.class) public void testException() { new InitialContext().lookup("Foo").bar(); } } The problem is that EJBException is caught in the test, not FooException . Looks like EJB

Topshelf exception

左心房为你撑大大i 提交于 2020-01-04 04:32:46
问题 I'm using topshelf and I'm getting this exception when I try to use the "-i" option to install as a service. Unable to cast object of type 'Magnum.CommandLineParser.SwitchElement' to type 'Magnum.CommandLineParser.IArgumentElement'. Exception occurs in this function static void Set(TopshelfArguments args, IEnumerable<ICommandLineElement> commandLineElements) { var command = commandLineElements .Take(1) .Select(x => (IArgumentElement) x) //EXCEPTION BREAKS ON THIS LINE .Select(x => x.Id)