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

Notification

Icon
Error

NCrunch is building assemblies by just opening specific files in Visual Studio
DCasado
#1 Posted : Monday, February 17, 2025 7:31:17 AM(UTC)
Rank: Member

Groups: Registered
Joined: 10/2/2024(UTC)
Posts: 22

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
Hi,

I noticed that by just opening specific files NCrunch is building this assembly and all dependent.


By just opening a file (configured as an embedded resource)

SomeFile.xlf

Ncrunch is building the assembly and all dependencies.


Is this normal behaviour?



I just send you a bug report.
The opened file is named: PlanningEngineTranslations.de-DE.xlf
Remco
#2 Posted : Monday, February 17, 2025 7:35:36 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,213

Thanks: 974 times
Was thanked: 1302 time(s) in 1207 post(s)
Hi, thanks for posting.

When opening this file, are you opening it in Visual Studio, or an external editor?

NCrunch will respond to changes on the file system. If you're using an external editor and it creates a resource lock file or something else on the file system that is being watched by NCrunch, this can trigger a build.

Edit: If you're using VS to edit the file directly (i.e. as XML), it's possible that loading the file into memory in VS actually causes a change in its structure. VS may be formatting the file differently to how it is physically stored in disk (in binary form). This difference causes NCrunch to naturally trigger on the file. You can probably identify the nature of this change by reading the file as it exists in the NCrunch workspace (right click the project, go to advanced->browse to workspace) and comparing it with its equivalent in your foreground solution using a hex editor/comparison tool.
DCasado
#3 Posted : Monday, February 17, 2025 8:15:42 AM(UTC)
Rank: Member

Groups: Registered
Joined: 10/2/2024(UTC)
Posts: 22

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
I opened it from inside Visual Studio. Opening such files from external editors doesn't trigger NCrunch to build the assembly.

It seems opening the same xlf file a second time doesn't trigger NCrunch to build.

Comparing both files from disk with KDiff3 shows me that they are binary equal.
But comparing content (copied from VS Code or VS 2022) from both files with KDiff3 shows me that they have equal text but are NOT binary equal.
Remco
#4 Posted : Monday, February 17, 2025 8:18:30 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,213

Thanks: 974 times
Was thanked: 1302 time(s) in 1207 post(s)
My guess would be that it's an encoding issue of some kind.

Probably when VS opens the file, it changes the encoding or normalises something.

If you open the file in VS, then save it, then close it and re-open it, does this trigger NCrunch?
DCasado
#5 Posted : Monday, February 17, 2025 10:30:45 AM(UTC)
Rank: Member

Groups: Registered
Joined: 10/2/2024(UTC)
Posts: 22

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
I don't understand what's happing here :(

I identified some other embedded files (*.json files) which have the same problem.

I use KDiff3 to compare both files (from solution folder and from NCrunch workspace folder) in two different ways:

  1. Opening the files directly by KDiff3 (in menu File -> Open)
    KDiff3 says both files are binary equal

  2. Opening the files in an external editor (Notepad++, VS Code, VS 2022)
    "Files A and B have equal text, but are not binary equal."



I don't understand why NCrunch is triggering a build although both files are binary equal on disk.
I don't understand why just opening both files, copy & paste content just change some binary data.
DCasado
#6 Posted : Monday, February 17, 2025 10:50:08 AM(UTC)
Rank: Member

Groups: Registered
Joined: 10/2/2024(UTC)
Posts: 22

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
I'm able to reproduce this issue by
- just creating a new .NET project in Visual Studio
- adding a JSON file to the project
- enabling NCrunch on the solution
-- then every time you close the JSON file
-- restarting the NCrunch engine
-- opening the JSON file will trigger NCrunch to build the assembly


This does not happen on opening .cs files.
Remco
#7 Posted : Monday, February 17, 2025 12:08:12 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,213

Thanks: 974 times
Was thanked: 1302 time(s) in 1207 post(s)
Thanks for this, I'll have a look and will see what I can do.
Users browsing this topic
Guest
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.042 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download