PDA

View Full Version : VS behavior on thrown Spring.Dao.EmptyResultDataAccessException


rvicups
06-04-2007, 11:44 AM
Hi all,

I know this is not really question on spring, but still its related.

After I downloaded spring.net 1.1 M1 some of my colleagues are getting code execution breaks when running application in VisualStudio in the places (in our project) where Spring.Dao.EmptyResultDataAccessException is thrown!

The weird thing is - with older spring.net versions it does NOT happen. We already tried to play with Exception settings of Visual Studio - without success.

Another weird thing is - code execution gets breaked no matter if we compile our project as debug or as release!

Also assumption that VS handles dll's that are compiled as 'Release' in the different way than those compiled as 'Debug' - was wrong. Code execution is interrupted in VisualStudio no matter which version (debug or release) of the dlls we are using.

Maybe some of you have had this same experience and have a good tip for me and my colleagues on how to solve it.

best regards
reinis

Erich Eichinger
06-06-2007, 12:05 AM
Hi,

can you plz post such a stacktrace?

tx,
Erich

RolandSchmitt
06-06-2007, 09:37 AM
Hi I am colleague of reinis ;)

here is the stacktrace of this exception, breaking in visual studio.#

greetz Roland

bei Spring.Dao.Support.DataAccessUtils.RequiredUniqueR esultSet(IList results)
bei Spring.Data.AdoTemplate.QueryForObject(CommandType cmdType, String cmdText, IRowMapper rowMapper, IDbParameters parameters)
bei FirstAnswer.Data.Persistence.Support.PersistenceTe mplate.LoadObjectByQuery(Type _type, String _commandText, IDbParameters _parameters)
bei FirstAnswer.Data.Persistence.Support.PersistenceTe mplate.LoadObjectByConditional(Type _type, String _conditional, IDbParameters _parameters)
bei FirstAnswer.Data.Persistence.CustomAttributeDAO.Lo adCustomAttributeByFilter(String _ownerClass, String _boCustomAttributeId, Int64 _tbMandatorId)
bei FirstAnswer.Service.DefaultImplementation.CustomAt tributeManager.GetCustomAttributeByFilter(String _ownerClass, String _boCustomAttributeId, Int64 _tbMandatorId)
bei Spring.DynamicReflection.Method_GetCustomAttribute ByFilter_7c40d8a9c8d74fbfb2d57411cd05d24f.Invoke(O bject target, Object[] args)
bei Spring.Util.DynamicReflection.SafeMethod.Invoke(Ob ject target, Object[] arguments)
bei Spring.Aop.Framework.ReflectiveMethodInvocation.In vokeJoinpoint()
bei Spring.Aop.Framework.AbstractMethodInvocation.Proc eed()
bei Spring.Transaction.Interceptor.TransactionIntercep tor.Invoke(IMethodInvocation invocation)

Bruno Baia
06-06-2007, 11:07 AM
Hi,

I got a long talk about this with Mark a long time ago, this behavior exists since 1.1 P3.

I was expecting that QueryForObject returns null if the entry does not exist in base, but it throws a Spring.Dao.EmptyResultDataAccessException exception.
It seems this is the same behavior in Java.

I had to use a QueryWithRowMapper instead :

IList<Program> programs = AdoTemplate.QueryWithRowMapper(
CommandType.Text, getProgramById, programRowMapper, "id", DbType.Int32, 0, idProgram);

if (programs.Count > 0)
{
return programs[0];
}
else
{
return null;
}



HTH,
Bruno

rvicups
06-06-2007, 11:59 AM
Hi,
no no we DO WANT EXCEPTION, heheh

Exception actually is reallly good, what we dont want is that VisualStudio breaks execution of code in debug mode IF exception is thrown.

I googled the other day to see how VS decides when to interrupt execution of code and when not. Some dude in Microsoft writes that VS is looking if code is un-optimized and contains symbols - in this case VS assumes its a user code and interrupts execution if an exception occurs.

The thing is, in the past (as in with old spring binaries) when we were debuging and used release versions of spring binaries, VS never interrupted execution as long as there were no UNHANDLED exceptions in our code.

What is different now, is that VS interrupts code execution and goes into debug mode on this particular spring exception EVEN THO it is in try... catch block.

hope this helps to understand our problem better
best regards
reinis

Bruno Baia
06-07-2007, 09:15 AM
The weird thing is - with older spring.net versions it does NOT happen.
Are you talking about 1.1 P3 or a nightly build between 1.1 P3 & M1 ?

Cheers,
Bruno

rvicups
06-08-2007, 11:36 AM
Hi Bruno, hi all,

exact version of the build we were using in the past and that did worked as expected (as in NOT interrupting code execution on dao exception) is this: "Spring 1.1 Build 20070206-2216"

kind regards
reinis

boriska
06-29-2007, 04:08 PM
Hello,

I got the same error, but in the another context.

[EmptyResultDataAccessException: Incorrect result size: expected 1, actual 0]
Spring.Dao.Support.DataAccessUtils.RequiredUniqueR esultSet(IList results) +109
Spring.Data.AdoTemplate.QueryForObject(CommandType cmdType, String cmdText, IRowMapper rowMapper, String parameterName, Enum dbType, Int32 size, Object parameterValue) +76


I developed an ASP.NET application and ran it on the VS.NET-integrated Development Server.
This worked fine and today I tried to deploy this app
on the IIS and got the EmptyResultDataAccessException.

What could be so different on the IIS? I suppose that the database connection wasn't properly initialised, but it is only my suggestion.

Regards,
Boris

--------------------------------------------------------------------------
I was putting an incorrect value ("ASPNET" account ) to a db function that should return user scecific info's
and the result was always empty :)

It was my mistake: instead of using the HttpContext.Current.User.Identity.Name I tried to get a current user name with the System.Security.Principal.WindowsIdentity.GetCurre nt().Name.
This worked for ASP.NET Development Server, of course not for the IIS;


--------------------------------------------------------------------------

RolandSchmitt
07-03-2007, 12:02 PM
bump! the last post has no relevance to this topic.
we have no problem that incorrecresultsize exception is thrown!
we have proble that this breaks visual studio in debug mode on this exception, what was not in spring 1.1 p3 release.

Erich Eichinger
07-03-2007, 12:48 PM
hi,

did you maybe install vs servicepack in the meantime? did you try to disable the vshost process for debugmode execution?

-Erich