Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

2 Pages12>
c++ filenames not fixed-up in stack traces
willdean
#1 Posted : Friday, November 30, 2012 10:53:33 AM(UTC)
Rank: Member

Groups: Registered
Joined: 1/31/2012(UTC)
Posts: 25
Location: England

Thanks: 7 times
Was thanked: 2 time(s) in 2 post(s)

If we have an exception thrown from C++/CLI code (which is called from a C# test fixture), then the filenames for the C++ source files in the nCrunch window stack trace point to the ncrunch copied temporary files, not the original source. CS files further down the list correctly point to the original source.

If you're unwise enough to click one of the C++ file hyperlinks in stack trace, then you can waste a huge amount of time (how do I know this...) editing nCrunch temporary files instead of your own source, and wondering why they're not rebuilding.

It's even worse if you're using VisualAssist, because the incorrect files pollute various caches, and VA refactorings start to go wrong.

I assume you're doing some kind of fix-up for CS filenames in stack traces, which for some reason doesn't work on CPP files? Can this be fixed?

Remco
#2 Posted : Friday, November 30, 2012 11:07:59 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,979

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Hi, thanks for sharing this issue!

I can understand the frustration behind looking at the wrong source file (earlier versions of NCrunch did this to me very often).

NCrunch basically fixes up the stack traces through its instrumentation. Because the instrumentation doesn't support C++ assemblies, the stack traces don't get adjusted. This problem also appears for projects that have instrumentation disabled for one reason or another.

The issue is already on the backlog, though I hadn't considered that it would also impact non .NET assemblies. Thanks for bringing this up as it definitely helps with prioritisation.


Cheers,

Remco
1 user thanked Remco for this useful post.
willdean on 12/1/2012(UTC)
willdean
#3 Posted : Saturday, December 1, 2012 11:20:00 AM(UTC)
Rank: Member

Groups: Registered
Joined: 1/31/2012(UTC)
Posts: 25
Location: England

Thanks: 7 times
Was thanked: 2 time(s) in 2 post(s)
One possible 'quick fix' might be to set the copied files as read-only - at least the IDE might then give an earlier hint that I'm working in the wrong file. Is that possibility?
Remco
#4 Posted : Sunday, December 2, 2012 1:33:32 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,979

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Setting files as read-only is certainly one way, but this would also make the workspaces less aligned with the foreground solution (i.e. where the files are not read-only), increasing the risk of people experiencing unexpected problems. One quick-fix could be to simply remove all stack trace navigation for files that are inside the workspace, so there's no way you can open up a workspaced file using NCrunch. It is, of course, better to just translate the paths if possible :) I may have an opportunity to do something about this in the 1.43 release. I'll see what I can do!

Cheers,

Remco
Remco
#5 Posted : Monday, December 10, 2012 5:29:14 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,979

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
1.43 has just been released including a change that disables source navigation to files that exist within NCrunch workspaces. While this isn't a perfect solution to the problem, it should at least prevent situations where files within workspaces are confused with files in the foreground solution. I hope this will save time and trouble!


Cheers,

Remco
willdean
#6 Posted : Monday, October 21, 2013 8:36:01 PM(UTC)
Rank: Member

Groups: Registered
Joined: 1/31/2012(UTC)
Posts: 25
Location: England

Thanks: 7 times
Was thanked: 2 time(s) in 2 post(s)
Remco,

This does seem to be fixed for C++ (thanks), but I'm now tripping over it on .TS (typescript) files.

Can you just stop nCrunch opening ANY files in the IDE which are located in the temporary build folders? Frankly I don't care the response is a flashing purple modal exception dialog with a loud bell sound, just don't open the wretched temp files in the IDE. I waste so much time making changes to the wrong file and then wondering why nothing's rebuilding...

Unrelated, but while I have your attention, does 2.0 fix the long-standing bug in the test window tree control, where you have to left click an item before right clicking it for a context menu? That's been driving me made for 18 months too...

Great product though, keep at it.

Remco
#7 Posted : Monday, October 21, 2013 9:53:32 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,979

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Hi,

It looks like the design of this has changed since the change mentioned earlier in this thread. Navigating to incorrect source files is a horrible nuisance and a big time sink. I'll mark this down for review to see if I can get it fixed properly (and permanently). Hopefully I can avoid any flashing purple modals!

V2 includes a complete rebuild of the tree control used by the Tests Window, so I think that the context menu usability issue is fixed - but I'll make a note to check it to be sure.

I'm glad you're enjoying NCrunch :)


Cheers,

Remco
Remco
#8 Posted : Wednesday, October 30, 2013 3:10:30 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,979

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Hi -

Sorry to resurrect this thread, but I'm currently trying to establish how you've managed to navigate to a source file in the NCrunch workspace using Visual Studio.

Do you remember how you opened the file? Was this done via a hyperlink in the NCrunch Tests Window? Or a mechanism that didn't directly involve NCrunch?


Cheers,

Remco
willdean
#9 Posted : Wednesday, October 30, 2013 7:11:52 AM(UTC)
Rank: Member

Groups: Registered
Joined: 1/31/2012(UTC)
Posts: 25
Location: England

Thanks: 7 times
Was thanked: 2 time(s) in 2 post(s)
Remco,

Cannot repro it here at the breakfast table, but in summary it was:

Vs2013
NCrunch scratch directory is set on a ram drive (k)
Asp.net mvc project had typescript file added to it
Errors in typescript file cause ncrunch to display compiler errors in ncrunch window, with hyperlinked filename
Hyperlinks point to files on scratch drive, not in proper location.

Hope that helps, can probably send you a minimal project if you need it.
Remco
#10 Posted : Wednesday, October 30, 2013 8:48:33 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,979

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Thanks. I've had no luck in reproducing any issues where NCrunch allows hyperlinking to files inside the workspace through the Tests Window... the fix released 10 months ago included code specifically intended to prevent this from happening, which is why I'm confused about how it's managed to happen in your environment.

My suspicion at the moment is that something in your environment opened the code window in response to something else happening ... perhaps a debug event of some kind? Do let me know the details if you manage to get it to happen again.
Remco
#11 Posted : Wednesday, October 30, 2013 8:48:34 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,979

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Thanks. I've had no luck in reproducing any issues where NCrunch allows hyperlinking to files inside the workspace through the Tests Window... the fix released 10 months ago included code specifically intended to prevent this from happening, which is why I'm confused about how it's managed to happen in your environment.

My suspicion at the moment is that something in your environment opened the code window in response to something else happening ... perhaps a debug event of some kind? Do let me know the details if you manage to get it to happen again.
willdean
#12 Posted : Wednesday, October 30, 2013 6:59:03 PM(UTC)
Rank: Member

Groups: Registered
Joined: 1/31/2012(UTC)
Posts: 25
Location: England

Thanks: 7 times
Was thanked: 2 time(s) in 2 post(s)
Remco;4779 wrote:
My suspicion at the moment is that something in your environment opened the code window in response to something else happening ... perhaps a debug event of some kind? Do let me know the details if you manage to get it to happen again.


I've just sent you, via the contact form, a screen shot of it. It's definitely a hyperlink in nCrunch pointing to the temp location, and it's definitely me clicking on that hyperlink which opens the (wrong) file.

It's in an excessively complex solution which would probably take you as long to open as it would me to zip up all the dependencies, so I'll try and build a simple repro.

Will

[Update: I just created a solution from scratch which repro'd this instantly here - so I can definitely help you track this down - I've mailed the whole lot to the support email address.]
Remco
#13 Posted : Wednesday, October 30, 2013 10:03:51 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,979

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Thanks Will! I think I can see what's happening here. It looks like the reversal of the path strings ('/' instead of '\') is messing with NCrunch. Hopefully this should be an easy fix. I'll see what I can do :)
willdean
#14 Posted : Wednesday, October 30, 2013 11:43:45 PM(UTC)
Rank: Member

Groups: Registered
Joined: 1/31/2012(UTC)
Posts: 25
Location: England

Thanks: 7 times
Was thanked: 2 time(s) in 2 post(s)
Remco;4781 wrote:
Thanks Will! I think I can see what's happening here. It looks like the reversal of the path strings ('/' instead of '\') is messing with NCrunch. Hopefully this should be an easy fix. I'll see what I can do :)


Ah yes, the decision to treat file paths as simple strings in .NET blights us into its second decade... Glad you found it, anyway.






willdean
#15 Posted : Thursday, October 31, 2013 11:17:00 AM(UTC)
Rank: Member

Groups: Registered
Joined: 1/31/2012(UTC)
Posts: 25
Location: England

Thanks: 7 times
Was thanked: 2 time(s) in 2 post(s)
And it's fixed in 1.48... Thanks very much.
Remco
#16 Posted : Thursday, October 31, 2013 11:18:36 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,979

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Absolutely! You're welcome! And thanks for taking the time to report the issue :)
willdean
#17 Posted : Wednesday, February 5, 2014 11:30:55 PM(UTC)
Rank: Member

Groups: Registered
Joined: 1/31/2012(UTC)
Posts: 25
Location: England

Thanks: 7 times
Was thanked: 2 time(s) in 2 post(s)
Sorry to reopen this thread, but I've just wasted another 15 minutes editing a file which turned out to be in the nCrunch scratch space - this using the latest V2 build, from a couple of days ago.

This is a C++ file, in a C++/CLI DLL built with the /CLR:PURE option.

I have a C# test harness (which uses nUnit) and I am stepping between that and the C++ DLL. It seems that the way the wrong file gets opened is if you step into it in the debugger - there's no danger of getting to it by a double-click on the nCrunch window, because you don't hyperlink the C++ source paths.

I can't be sure exactly what sequence of breakpoints and steps leads to VS opening the wrong files, but it definitely does happen.

Are you able to make any statement about your intentions re C++? It's definitely a poor relation ATM - and if anything it feels slightly flakier in V2 than it did previously.

nCrunch also seems particularly bad at building dependent projects which are not .NET references (e.g. unmanaged DLLs). I know the story to do with C++ cross-project dependency is very complicated, so you have my sympathy, but unreliable rebuilding can be hideously time-wasting, and I suspect it must also impact other language projects that people might be interested in.



Remco
#18 Posted : Thursday, February 6, 2014 1:36:37 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,979

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Hi,

I'm sorry to hear that this has costed you time. Since this issue was first raised, there have been several fixes to avoid NCrunch from introducing any kind of hyperlink from the UI into files in the workspace. It should now be impossible to navigate to a workspace file via NCrunch, though of course NCrunch cannot control the behaviour of Visual Studio's debugger.. so I'm not sure if there's much I can do about this specific situation.

C++ is a very complex area to play in, largely because the build process for it is much more sophisticated than that of other languages used by Visual Studio. It took years of trapping and fixing build issues for NCrunch to reach the current maturity it is now at for C#/VB.NET/F#, and I expect that with considerable focus, it would also take much time to reach the same level with C++. Because C++ is not a language targeted by NCrunch (i.e. it is not supported by the instrumentation nor is there integration with C++ test frameworks), there is very limited value in trying to reach rock-solid build support for it. The only way this would become viable is to fully expand NCrunch support into C++, which is a major project for which no plans currently exist.

So C++ build support is just best effort at the moment. You're welcome to report specific issues that you experience with it and I will look at ways to try and improve things, but the priority is on C#/VB.NET/F# for now.
willdean
#19 Posted : Thursday, February 6, 2014 8:42:50 AM(UTC)
Rank: Member

Groups: Registered
Joined: 1/31/2012(UTC)
Posts: 25
Location: England

Thanks: 7 times
Was thanked: 2 time(s) in 2 post(s)
Remco;5224 wrote:

So C++ build support is just best effort at the moment. You're welcome to report specific issues that you experience with it and I will look at ways to try and improve things, but the priority is on C#/VB.NET/F# for now.


OK, that's fine - I quite understand. Could we perhaps have the *option* to have nC set the write-protect flag on source files it copies to the scratch area. That would at least give a warning that I'm trying to edit the wrong file? I know we discussed this above, and you're reluctant to casually introduce differences between the real project and the copy, but this could be a great help.

Thinking about it, I might be able to implement this myself as some kind of pre-compile step in the project - I'll try that first...





Remco
#20 Posted : Thursday, February 6, 2014 8:52:18 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,979

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Yes - this is definitely one way the problem can be solved, or at least managed better.

There was a feature recently added in NCrunch that can disable the auto-build for certain files in the solution. This configuration setting was based off wildcards and could be adjusted at project level. It is possible that a read-only-applying setting could be introduced along similar lines.

My first preference though would be to have this solved using a pre or post build step in your project. The list of configuration settings for project files is getting longer and longer in NCrunch, and some people have mentioned they feel a bit daunted by it. I'd rather use a new config setting as an absolute last resort.

If writing a script to do this in your build process ends up being particularly untidy, you might want to look at MSBuild's item batching features. It's possible to create a custom MSBuild target that can batch compiled files over to command-line invoke or custom build task to set the read-only flag.
Users browsing this topic
Guest
2 Pages12>
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.112 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download