Why is Visual Studio dropping me into a disassembly window when debugging? - visual-studio

I am facing a strange problem while I am debugging my program.
I developed a program that was working fine. Even when I made a minor change (added a hard-coded statement instead of putting watch for a variable and changing its value) in one part of the code, it was still working fine. But then I removed those changes, and from that point onward the program has been behaving very oddly. The variable that was hard-coded is still keeping the hard-coded value and not the one it should have according to flow.
I changed the line number 24 with the statement
return "shweta#2k7.com";
and again reverted the change to make it similar to the previous one, except that I deleted one blank line. So the total number of lines in the current code is 1 fewer than the previous code as shown below.
Now when I debug it, the control goes up to line no 26 even though there is nothing written there, and it returns the previous value "shweta#2k7.com" (which occurs nowhere in the code), instead of " ".
Current Code:
1 public string GetUserEmail(string userName)
2 {
3
4 if (!UserExists(userName)) return "";
5 try
6 {
7 DirectorySearcher search = new DirectorySearcher(_directoryEntry);
8 search.Filter = "(SAMAccountName=" + userName + ")";
9 search.PropertiesToLoad.Add("mail");
. .
. .
. .
19 }
21 catch
22 {
23 return ""; //"username#domain.com";
24 }
25 }
Previous Code:
1 public string GetUserEmail(string userName)
2 {
3 if (!UserExists(userName)) return "";
4 try
5 {
6 DirectorySearcher search = new DirectorySearcher(_directoryEntry);
7 search.Filter = "(SAMAccountName=" + userName + ")";
8 search.PropertiesToLoad.Add("mail");
. .
. .
. .
18 }
22 catch
23 {
24 return "username#domain.com"; //line number 24
25 }
26 }
After returning from this function, control passes to the Disassembly window where some assembly code is displayed.
Why is this happening?
Yes you are correct, It is running older version.
I am using Visual studio 2008. I did all such things like cleaning solution prior to Build/rebuild. But no gain.
I know the line inside catch executes only if try block fails, but here scenario is different(confusing too). It is not looking whether try failed or succeed, it is just looking line numbers. because when there is nothing in the line 26, then also control goes there.
I tried by removing blank line at 26, then control went to line 27(26 after removing blank line). you'll wonder by knowing that there was comment at line 27!!
However I have checkout the last safe version from SVN, and that worked fine.
But I'm also curious to know about this.

Shweta,
Line 24 is inside a catch statement, which is executed only if the try() fails. Is it possible that the try() succeeds, so Line 24 never executes?
On second thought, this smells like a case of not running the code that you think you're running: is it possible that your new source hasn't compiled properly, so you're still running the old version? If you're using an IDE (or a good makefile), you might try running clean, or manually deleting the object and executable files, and then rebuilding from scratch.
When you find the problem, please post a follow-up. I'm curious!
Good luck.

Related

Incoherent local/global line numbering in Scinotes

When I switch on the "local line numbering" option in SciNotes, I get a strange effect. The line numbers show as local (starting with the "function" line) for some of my functions, but global (counting from the beginning of the code file) for others.
My first thought was that a function wasn't ended properly (too few "end" instructions wrt the number of opened loops, ifs and other such), but then my code would crash, which it doesn't. Also, indentation looks fine when I auto-adjust it.
It doesn't very much get in my way, but I wonder if it isn't a symptom of something more serious cooking under the surface. Has anybody had a similar experience?
FWIW I'm using Scilab 6.0.2 under Windows 10.
I think I have found the source of the "problem". Line numbering only gets local in a function whose first line (the one with the "function" keyword) is not terminated with a semicolon.
Like this:
1 // This is my fantastic power program
2 clear;
3 clc;
4 cd "c:\myDir\Scilab\Sandbox\FunAndGames"
5
6 function S=square(x); // <-- now you see it
7 S=x*x; // (the semicolon, I mean)
8 endfunction;
9
1 function C=cube(x) // <-- now you don't
2 C=x*x*x;
3 endfunction;
13
14
15 // Now the body of my program:
16
17 X=zeros(5,5);
18 ....

pgAdmin 4 v3 Auto Indent not working

Since upgrading to 4.3, Auto Indent is not working (working in a Query Tool tab). When pressing enter at the end of a line of code, the cursor appears at a random position on the next line (sometimes right at the end) and not at the correct indentation position. This is very frustrating, as I have to click at the beginning of the line and indent correctly myself for every new line.
I have tried Chrome and Edge with no difference. I have changed the Tab Size and Use Spaces Options without any luck. I am using Windows 10 Pro.
Anyone else with this problem?
UPDATE!!!
This issue is fixed in pgAdmin 4 Version 4.3!
Thank you pgAdmin Team!
Note: This is still an issue up through pgAdmin 4 version 4.2
Updated: Feb 19, 2109
:(
/*
Issue:
(Tested on Windows Server 2012 R2, Chrome and Firefox, pgAdmin 4 3.2)
Using nested functions in a variable assignment, or just in a SQL statement
causes multiple tabs to be added when hitting enter for a new line anywhere
later in your code.
If you uncomment the first line with nested functions (below), all
carriage returns lower in the code create new lines with
many unwanted tabs.
Uncomment the line below and hit enter at the end of the line,
or before another line of code.
*/
/*
x := upper(substr('uncomment to test this. Hit enter after the semicolon.', 13));
*/
/*
My workaround is to unnest the functions and use multiple statements.
Note: Be sure the offending line above is commented out.
*/
x := substr('uncomment to test this. Hit enter after after the semicolon.', 13);
x := upper(x);
Have tried your suggestion and it does work. But it does seem odd that we have to comment out the entire offending line (i.e. with the nested text) to make this work. I haven't had this issue with other editors. For example, entering the same text in SQL Developer as follows:
SELECT *
FROM employees
WHERE deptno IN (SELECT deptno FROM departments
WHERE loc = 'CHICAGO');
Pressing enter will place the cursor under the 2nd WHERE (same as Postgres). I clear the tabs with Shift+Tab to column 1, and going forward I am fine. Each new line, cursor is at the beginning. This doesn't work with Postgres.
I am still new to a lot of this. Thank you for sharing.

cudnn without any framework

Does anyone have an idea, what is matched wrong.
It compiles without any error, etc., but the Output goes always from Predict class 5 to 3 to 1 and doesnt change.
Code(important here PropagationHelper&Network&Layer):
Output:
Update Weight(Value of ConvGradConv is to huge!)
Networkflow(first 5 and last 5 data in each layer)
Okay one Error corrected(FullyBackward used inchannel insteed of inputsize), but there must be another one with the ConvLayer.

What does Get do in VB6?

I'm trying to modify a program someone wrote in VB6 in the sem-distant past, and have come across the line below, and many similar ones. My question is, syntactically, what does this "Get" line look like it does or might do?
Get #3, StartByte + Offset, StudentScrBytes
Within the program, it's ALWAYS followed by 3 comma-separated items, and with one exception, the first item is a number preceded by #. The second looks to always resolve to a number, and the third a single variable.
I'm fairly sure I've figured out the numbers preceded by # are a file reference - the first time Get appears, instead of #3 or #10 or #whatever, it has a variable "TempFile" instead, initialized as FreeFile().
TempFile = FreeFile()
Open "c:\folerName.dir" For Binary Shared As TempFile
The only stuff I've been able to find on Get in VB6, seems to relate to OOP and getters/setters. Maybe I'm wrong, but I really don't think that's what's going on here, and all I have are vague guesses as to what is.
Here's the function the line was taken from. Both arguments are integers.
Function StudentScr$(Record, Contest)
Dim StudentScrBytes As String * 4
StartByte = (Record - 1) * LengthOfStudentRecord
If Contest = 1 Then Offset = 77
If Contest = 2 Then Offset = 85
If Contest = 3 Then Offset = 94
If Contest = 4 Then Offset = 102
If Contest = 5 Then Offset = 110
If Contest = 6 Then Offset = 118
If Contest = 7 Then Offset = 126
If Contest = 8 Then Offset = 134
Get #3, StartByte + Offset, StudentScrBytes
StudentScr$ = StudentScrBytes
End Function
I would think Get would get something from the specified file, except I can't tell how (or if) a file is even specified at all.
Have a look at the original MS VB6 documentation:
https://msdn.microsoft.com/en-us/library/aa243376(v=vs.60).aspx
You may also be interested in its counterpart Put:
https://msdn.microsoft.com/en-us/library/aa266212(v=vs.60).aspx
Hint: when searching for legacy VB statements, include "vs.60" for Visual Studio 6.0 in your Google search, and restrict your search to the MS site. MS hast this term in the official link, so you can not miss it. This search:
vb6 vs.60 get put site:microsoft.com
does bring up both Get and Put as the two first Google answers on my machine.

Compile Time Incredibly Slow

My project consists of ~350 Swift files and ~40 cocoa pod dependencies.
As soon as the entire project was migrated to Swift 3, build times have been INCREDIBLY slow and took a little over 3 minutes to completely compile.
I've noticed that if I rebuild after not changing any files, it builds within a reasonable amount of time. However, if I add a new function, it takes the 3+ minutes.
Cocoapods does not seem to be causing the problem as it delays on Compiling Swift source files state.
I followed this to investigate:
Added the -Xfrontend -debug-time-function-bodies flag to my Other Swift Flags in my target's build settings
Build the project
Copied this into terminal and ran pbpaste | egrep '\.[0-9]ms' | sort -t "." -k 1 -n | tail -100
However, I didn't see anything of concern. The file that took the longest to compile was only 250ms. The next closest was 100ms, even if all 350 files took 250ms to compile, that would only be a total of 73 seconds which is way off from the 3+ minute builds I am seeing.
What could be causing these long compile times?
It was never as slow before updating to Xcode 8 and Swift 3.
Update 1:
I created a new project without running the Swift 3 conversion, imported my Swift 3 files, but the build time remains the same.
Update 2:
I've tried SWIFT_WHOLE_MODULE_OPTIMIZATION = YES, but as soon as you make changes to more than 1 file, the incremental build fails and it triggers a re-build which lasts for more than 4-5 minutes.
Update 3:
I've now re-written my entire code base from Swift 3 to Swift 2.3. It didn't make any difference, the problem lies with the Xcode 8 compiler.
Update 4:
I can confirm that unchecking these two
will alleviate the pain for a while, the Xcode 8 bug does seem to be tied to how it checks dependencies between files.
Update 5:
I've converted my code base to Swift 3 from Swift 2.3 since Xcode 8.2 beta requires it, the beta should include a fix for "Xcode will not rebuild an entire target when only small changes have occurred. (28892475)". Sad to say, they haven't fixed the bug and my compile times are exactly the same with Xcode 8.2 Beta.
Original post:
I don't have enough reputation to comment, but I still wanted to share some resources. I've been stuck in this misery for days, upgrading to Swift 3 has been a complete disaster.
I'm using this to track slow files, even though just like you, that's not my problem. Something else in xcode is taking literally 4 minutes to complete:
https://github.com/irskep/swift_compile_times_parser
https://github.com/RobertGummesson/BuildTimeAnalyzer-for-Xcode
I've also made sure I don't have any lazy vars or closures that swift doesn't like. Don't use the + operator when concatenating strings, etc.
see this.
I'll update this answer if I find anything, it's just about impossible to be productive with Swift 3 ATM.
I'm using Xcode 8.1 My issue was with Dictionary which uses Nil-Coalescing Operator
this is my code when it takes 10 minutes to build:
let params: [String:String] = [
"email": email ?? self.email,
"clave": password,
"tipo_documento": documentType?.rawValue ?? self.typeDocument.rawValue,
"documento": number ?? self.documentNumber,
"nombre": name ?? self.name,
"apellidos": lastName ?? self.lastName,
"fecha_nacimiento": birth?.parse() ?? self.birthDate.parse(),
"genero": genre?.rawValue ?? self.genre.rawValue,
"telefono_movil": cel ?? self.cel,
"direccion": address ?? self.address
]
I don't know why but it advertise me that the Dictionary take a long time to compile.
Then I change it to:
var params: [String:String] = [:]
params["email"] = email ?? self.email
params["clave"] = password
params["tipo_documento"] = documentType?.rawValue ?? self.typeDocument.rawValue
params["documento"] = number ?? self.documentNumber
params["nombre"] = name ?? self.name
params["apellidos"] = lastName ?? self.lastName
params["fecha_nacimiento"] = birth?.parse() ?? self.birthDate.parse()
params["genero"] = genre?.rawValue ?? self.genre.rawValue
params["telefono_movil"] = cel ?? self.cel
params["direccion"] = address ?? self.address
Hope it could help some of you.
Also string concatenation seems to be incredible slow in Swift3/XCode8:
item.text = item.text + " " + pickerText + " " + (attribute?.Prefix ?? "") + inputText + (attribute?.Suffix ?? "")
~ took 8-10 seconds to compile
item.text = "\(item.text) \(pickerText) \(attribute?.Prefix ?? "")\(inputText)\(attribute?.Suffix ?? "")"
~ took 1,6 seconds to compile
item.text = [item.text, " ", pickerText, " ", (attribute?.Prefix ?? ""), inputText, (attribute?.Suffix ?? "")].joined();
~ took 0,001 second to compile
SWIFT_WHOLE_MODULE_OPTIMIZATION = YES
Xcode version: 8.1 GM
To add choose your target, then go to Editor > Add Build Setting > Add User-Defined Setting, and add the above.
My clean build time dropped from 35 mins (Ahem, excuse me) to 8 mins with a project file count of 800.
Note: Tried this on Xcode 8.0 first, but didn't work.
I found a couple of coding styles that take a lot of time compiling in Swift (2.3, not tested on 3):
a += b
Should be
a = a + b
Also adding array together:
var a = [1,3,4]
var b = [5,6,7,8]
var c = [8,4,3,5]
var d = a + b + c
Should be
var a = [1,3,4]
var b = [5,6,7,8]
var c = [8,4,3,5]
var d : [Int] = []
d.appendContentsOf(a)
d.appendContentsOf(b)
d.appendContentsOf(c)
The last optimization took the compilation time for 1 method from 9800ms to 5.5ms...
I migrated a Swift 2x project of 17 files to Swift 3 and had 28 warnings and 55 errors across all files. Compile time was 4-5 minutes.
Disabling
Find Implicit Dependancies
in scheme and
SWIFT_WHOLE_MODULE_OPTIMIZATION = YES
made only minor improvements.
As I eventually cleared the warnings and errors in each file, the compile time reduced and is now in the seconds. The IDE is back behaving as it should - detecting errors in near real time and compiling quickly.
Firstly, it looks like the compiler is recompiling (or at least cross checking) every file with any error or warning - even if you haven't edited that file since the last compile.
Secondly, if there are too many dependant errors/warnings across files, the compiler bottlenecks and slows right down.
Whenever you face slow compilation issue, closly looks the the third party SDKs you included in your app and also try to find your coding techniques.
I face this issue twice in my app and I felt like harrassed by Swift 3 😡. Both the times reasons were different.
First time I found that I added a library in my app named AASignatureView. Since this lib was added, my compilation time increased like hell. It started taking near 12-15 Mins in running the app on simulator. The issue was resolved after I removed this lib from my code and added VMSignatureView and my compilation time went into normal state.
Second time I faced this issue after making a code of appending several Strings. Both of these below methods turned app's compilation time to hell
a = a + b
and
a += b
Then I changed my code to below way and the problem was solved.
a = "a\(strSometihng),\(strAnother)"
Concatenating several Strings also can cause increasing compiling times, for example in my case, my compilation times where very high because of this line:
let fecha = post.dia + " " + post.num_dia + " " + post.mes + " - " + post.hora
When i changed the code to this, it satart compiling in seconds:
var fecha = post.dia!
fecha = fecha + " "
fecha = fecha + post.num_dia!
fecha = fecha + " "
fecha = fecha + post.mes!
fecha = fecha + " - "
fecha = fecha + post.hora!

Resources