SharpSnmpLib SNMP read exception using library SharpSnmpLib - exception

I get exception when doing snmp get.
Here is the Wireshark dump of the packet that gives the exception:
Lextm.SharpSnmpLib.SnmpException: data construction exception --->
System.ArgumentException: Truncation error for 32-bit integer coding.
Parameter name: length

I found the problem I was sending too big requestID or negative requestID which are not supported by some devices!
Use this option to disable negative request ID
Messenger.UseFullRange = false;

Related

Cannot use transfer or send on solidity

I use Ganache, truffle.
I get the following error:
Error: [ethjs-query] while formatting outputs from RPC '{"value":{"code":-32603,"data":{"message":"VM Exception while processing transaction
I have located the problematic piece of code:
bool sent = _sellerAddress.send(_price);
Now, I get the price via the user interaction, and when the price is 0, then the error is not thrown,
unfortunately in the classic case when the _price is no zero, the exception is thrown.
Any suggestions?

Can we set the characters limited to 10 characters in log4net %property?

This is my threadContext exception message property
log4net.ThreadContext.Properties["excmessage"] = ex.Message;
I want to get the first 10 characters of exception message property using log4net.
This is the line in Log4net.config:
%property{excmessage}
As far as I can tell you can only "truncate from the beginning" which means you get the end of the string:
%.10property{excmessage}
Here is a link to the documentation:
http://logging.apache.org/log4net/log4net-1.2.11/release/sdk/log4net.Layout.PatternLayout.html
I suggest that you fill two properties: one with the exception message and the other with the truncated message.

JUnit4 - format assert message _after_ failure detected

Supposing I have non-trivial calculation function taking a bunch of parameters. And I have to test it for at least thousands of cases.
And I would like to have detailed message with all parameters values specified when certain case fails. I can format message string before check and pass it to assertXXX method. But it is very ineffective. My test spends most of its time formatting strings.
My question is:
Is there any smart way to format message string and pass it to JUnit after a test failure is detected and only then?
if (foo.conditionThatCanFail()) {
fail("condition failed for "+ foo);
}
As #bmargulies suggested, some assertion frameworks l(ike Hamcrest, Fest or Truth) will provide a nicely formatted failure message if an assertion fails.

Why does WinRT limit my unhandled exception messages/stack traces to 512 characters?

So I'm trying to test the logging of unhandled exceptions in a C# Windows Store app. I found with particularly large stack traces or exception messages however, I lose critical information to some arbitrary 512 character limit.
So, I have my handler like so:
void App_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
string tmp = e.Message;
var x = e.Exception;
}
Of course, due to the exception crossing language boundaries, the exception object provided is next to useless. The only info it carries is that "an exception of type System.Exception occurred". No stack trace or anything. Luckily, there is also the Message property though which contains most of the relevant information for logging exceptions.
However, It's limited to 512 characters!? So, here's an example:
Using this: throw new Exception(new string('c', 480)); I get this as the message:
System.Exception:
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
at App2.A
Notice it's cut off, right at the 512 character boundary. Here is what is looks like with a short exception message
System.Exception: cccccccccc at
App2.App.OnLaunched(LaunchActivatedEventArgs e)
Can someone explain to me why the only useful field given for tracking unhandled errors in your application is for some reason limited to a very small amount of text?!

Fetching Error Code in mule

I want to create a custom exception message in case exception is thrown by my mule service. In order to do that, i want to separately capture mule generated ErrorCode. Is there any property using which i can get that value? I tried using #[org.mule.config.ExceptionHelper.getErrorCode(Exception.class)]" but this returned -1 as a value instead of the actual exception code.
What method can i use to fetch ErrorCode?
You are supposed to pass the class of the current exception, ie:
#[org.mule.config.ExceptionHelper.getErrorCode(exception.class)]"
exception is the current exception while Exception is the java.lang.Exception class for which there is no error code associated.