|
OMG that is terrible
try {
Filtering = !filters.IsEmpty;
}
catch(Exception ex) {
}
finally {
Filtering = !filters.IsEmpty;
}
|
|
|
|
|
My guess is that either "filters" isn't instantiated or is getting instantiated at the same time that it is being called. What is happening when "IsEmpty" is called? It might be trying to kick something off when it is called.
|
|
|
|
|
I second that request. Can we be shown the IsEmpty code please? Can't be too many company secrets hidden in there... god, please say there isn't!
|
|
|
|
|
public bool IsEmpty
{
get {
try {
return _filters.IsEmpty();
}
catch (NullReferenceException e)
{
InstantiateFilters();
throw new NullReferenceException("Try it again now please.");
}
}
}
|
|
|
|
|
That tells you everything. You're variously trying to call an IsEmpty() method on a null _filters object. The exception is caught, InstantiateFilters() then fills up your filters variable from your calling code. The next time around in the finally it calls on the IsEmpty property again but this time _filters has been instantiated and the 'try' passes without a problem.
|
|
|
|
|
I'm not the OP so I have no knowledge of the actual code. That was just a stupid joke on my part.
|
|
|
|
|
bool IsEmpty { get; }
Member of System.ComponentModel.ICollectionView
|
|
|
|
|
Outside of that...
Who knows the context, but I'm going to guess that filters is a private member property, and Filtering is exposed.
Why wouldn't someone just make Filtering a public, get-only convenience property then, rather than setting some piece of data, where we now have to maintain two things?
|
|
|
|
|
|
I challenge you to code me a rotating potato. This is a serious challenge, are you up to the task?
|
|
|
|
|
Seriously, we only do broccoli here.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
My potatoes do not rotate. They spin in complex four dimensional time-like curves, and give the appearance of growing and shrinking in size as a result when viewed in 3D.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
These potatoes you speak of, do they power the Tardis?
When you are dead, you won't even know that you are dead. It's a pain only felt by others.
Same thing when you are stupid.
modified 19-Nov-21 21:01pm.
|
|
|
|
|
Nah, The Doctor ran out of galvanised nails and copper wire.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
object o = new Potato() ;
o.Rotate();
Well OK, only if it's a spherical potato.
|
|
|
|
|
Doesn't Rotate have parameters? An Axis, a velocity, or force vector?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Does that matter to a spherical potato? Can you even see whether or not a sphere is rotating?
|
|
|
|
|
Well it can - it's got eyes!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
|
Sometimes people get a little bit LINQ giddy:-
int fileFormtId = ds.Tables["ExpectedDailyBrokerFiles"].AsEnumerable().Where(x => Fits(Utils.ISS(row["File Name"]), x.Field<string>("Mask")) && x.Field<int?>("CHID").HasValue && x.Field<int?>("CHID").Value == Utils.ISInt(row["FileSourceID"])).Select(x => x.Field<int>("FileFormatId")).ToList().FirstOrDefault();
|
|
|
|
|
Well, if you remove all the other cruft, a AsEnumerable().Where().Select().FirstOrDefault() isn't that bad.
However, ToList().FirstOrDefault() is overkill, and with nullable types, why check for HasValue ?
Marc
Latest Article - Merkle Trees
Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny
Artificial intelligence is the only remedy for natural stupidity. - CDP1802
|
|
|
|
|
..and the mixing type safe and type unsafe field access
..and the fact that it's wrong but I can't see where
..and its a client side join between tables for which a server side view already exists
and so on.
|
|
|
|
|
From code that is licensed under the MIT license, so feel free to use it
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
You have to be at least a little bit insane to be a developer. It's OK.
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
that code means that it must really be 'true' not 'TRUE' or 1, or even non-zero.
There are a lot of cases where it makes sense. So such code might get enforced by some source code scanner policies.
You learn to honor such tools, when co-working with some code-jockeys
Press F1 for help or google it.
Greetings from Germany
|
|
|
|