I'm using PHPUnit (4.1.3) and it calls something as dead code:
it really annoys me. Its OK that codes after return are dead, but calling a closing bracket as dead code is just overkill
XDebug parsing issue, so the closing brace is not executed after the return statement since the code leaves that function and does not actually execute the closing brace. This is a known issue in the XDebug/PHP/PHPUnit parsing/executing space.
Related
I'm currently trying to learn F# and am having some problems with the Visual Studio 2015 debugger. Taking the following code as an example (I'm playing around with ASP.NET Web API):
[<Route("api/HomeApi/VideoCapture")>]
[<System.Web.Http.HttpGet>]
member this.VideoCapture() : HttpResponseMessage =
let response = this.Request.CreateResponse()
this.SetupCameraConsumers()
this.SetupCapture()
response.Content <- new PushStreamContent(this.Test())
response
I have put a breakpoint at the first line in this method, stepping over the 'let' works fine, but when I try to step over the next line, VS debugger essentially continues to the end of the method without throwing any errors. Within the this.SetupCameraConsumers() call, I am simply adding some objects to a list and returns a 'unit'.
Has anyone come across anything like this before? If I can provide any more information please let me know - I've used the VS debugger for C# code and have never encountered anything like this.
Am I calling a method correctly? Is this allowed in F#?
Thanks!
Just for anyone else who may run into this issue, disabling the debugging option 'Just my code' allows me to step over the code. I'm not entirely sure why that should make a difference though. Thanks again for the helpful comments provided.
I was wondering if you have encountered this bug before:
On a single-line of IF, the condition returns FALSE but then the execution proceeds to the TRUE part.
Am I doing something wrong here? retries and errorTolerance are both of type Integer and from the screenshot below, retries is less than errorTolerance. But still it executes the statement for the True part.
This has been screwing up my program so what I did was place the Throw New Exception in another line and close with End If and it works.
I guess my question will be what's wrong with my previous code?
Disable optimization to make sure that there is a clear linear correspondence between lines of code and the corresponding compiled instructions.
If this is release mode compilation, and retries is just a local variable going out of scope, the compiler may have just optimized away storing of the incremented value in the register that holds retries initially, but still use that register when inspecting the expression.
To confirm this, you will see retries and errorTolerance to have the same values in release mode, and retries having a value larger by one after recompiling in debug mode. Inspect the variables individually as you step through the lines.
Since I can't afford not to continue coding, I resorted to the regular If...End If block. Visual Studio and the compiler runs the code perfectly, although it left me wondering why this expression stymied VS.
I'm issuing a serious problem using php-fpm and pcntl_fork.
Both are working pretty well, but when they are together, I "loose" standard output for web browser. This mean the fork works, but the standard output (client browser) is totally lost for everybody (all children and the parent).
Outside fpm (in command line for example) the fork works as expected (all children print to terminal output).
Does someone gone something working or it's general problem with php-fpm ?
Ok I finally found the good way...
The code I use (which can be found at many place) use exit(0) function on child process to terminate it. But on php-fpm this also kill the main process... That's why it was not outputing after first child call...
Here is solution (found on pcntl_fork user comment):
register_shutdown_function(create_function(
'$pars', 'ob_end_clean(); posix_kill(getmypid(), SIGKILL);'
), array());
This will kill as expected any zombie at the end of script without killing main process
I have an VB ASP.NET (.aspx) file that has deeply nested logic and I'm getting lots of build errors like "If must end with a matching End If" and "Do must end with a matching Loop". How do I begin to debug this beast to at least get it to build?
The simple answer is to remove a large nested section and if it passes add a bit more until it fails. That's how I approach a problem like this.
Debugging starts after you get it to compile. Really effed code that won't compile you sometimes have to comment out blocks of code fix whats left and uncomment. Also if it just went haywire all of a sudden check for quote issues as a missed quote and break the whole file.
I have found that Visual Studio will generate the correct ending statements, so you have probably deleted a line by mistake, or commented one out.
As a rule, I try to avoid deeply nested statements. Can you refactor? A sequence of IF / ELSE IF / ELSE IF / ELSE / END IF construction is easier for the human eyes and mind to parse. Maybe even temporarily take some deep logic and make a temporary function. Remember, someone will have to maintain your code - and even if that someone is you, in 12 months time, complex structures are almost intelligible.
See code below, for some reason it only works when I put a breakpoint on line 2 (*) is there some delay? Is it starting the next line before it finishes the 2nd one?
dp.SSLCertStoreType = nsoftware.IBizPayPal.DirectpaymentSSLCertStoreTypes.sstPEMKey
*dp.SSLCertStore = My.Computer.FileSystem.ReadAllText(Server.MapPath("\cert_key_pem.txt"))
dp.SSLCertSubject = "*"
Note: The error is thrown on the 3rd line only when the breakpoint is set on the 2nd line, after releasing the break the program executes my paypal purchase via credit card.
I will post the error again I am replicating it now...
System error: Could not acquire security credentials: error 8009030E.
There it is, while it should say "Order Confirmed!" type message if working correctly.
Almost certainly a threading issue, but nobody is going to be able to answer definitively unless they're familiar with nsoftware.IBizPayPal
Sometimes you can find that breaking can mutate an object's state, due to the locals window evaluating object properties. If they have a side-effect, then all bets are off, unfortunately :( No idea whether this is happening in your case.
I have no knowledge of ASP, so just wondering aloud: Could this be due to multithreading? You know when you put a break point you sort of freeze execution of all threads, but not so in the real execution.