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

Notification

Icon
Error

3 Pages<123>
Support for C# source generators?
Remco
#22 Posted : Thursday, June 10, 2021 1:16:26 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
tkarlsen;15485 wrote:
It doesn't seem like there is any interest in fixing this, making NCrunch unfortunately unusable for us. Maybe we will renew our licenses if it ever gets implemented, but this lack of responsiveness is worrying.


Would you be interested in providing us with a working sample solution that uses the latest version of source generation to produce working code?

I ask this as we again attempted to implement support for this feature about 3 weeks ago and had no luck in actually building a test solution that we could work with. Presently, MS's documentation for this area is lacking in consistency and the whole of source generation has a distinctly 'preview' feel to it. This is a new area and there's a lot we don't understand about it. If you have this working well for you, we'd really appreciate your support in helping us replicate this so that we can extend NCrunch support to it.
ndeslandes
#23 Posted : Tuesday, June 29, 2021 6:50:29 PM(UTC)
Rank: Member

Groups: Registered
Joined: 2/12/2014(UTC)
Posts: 10
Location: United Kingdom

Thanks: 2 times
Was thanked: 3 time(s) in 2 post(s)
Hi @Remco,

Are you still looking for a working solution with the problem? I can probably cook one up if that helps.
Source generators have just been introduced in our solution, and I now find myself in the same situation as tkarlsen, with NCrunch now being simply unusable :-(.
Remco
#24 Posted : Wednesday, June 30, 2021 12:22:53 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
ndeslandes;15496 wrote:

Are you still looking for a working solution with the problem? I can probably cook one up if that helps.
Source generators have just been introduced in our solution, and I now find myself in the same situation as tkarlsen, with NCrunch now being simply unusable :-(.


Yes!! We still need a self contained code sample that can work with source generators (and make NCrunch fail). It must be the latest version of the tooling. Our attempts on this side to build such a sample have so far failed.
ndeslandes
#25 Posted : Wednesday, June 30, 2021 9:49:24 AM(UTC)
Rank: Member

Groups: Registered
Joined: 2/12/2014(UTC)
Posts: 10
Location: United Kingdom

Thanks: 2 times
Was thanked: 3 time(s) in 2 post(s)
Remco;15497 wrote:
[quote=ndeslandes;15496]
Yes!! We still need a self contained code sample that can work with source generators (and make NCrunch fail). It must be the latest version of the tooling. Our attempts on this side to build such a sample have so far failed.


Cool; there you go: https://github.com/nicodeslandes/SourceGenApp

That's about as basic as it gets; it has a console app and an NUnit project that both use the "CodeGenerator" project in the solution to generate a "HelloWorldGenerated.HelloWorld" class that gets called by them.

Visual studio and dotnet test are both fine with it. NCrunch fails to build both projects:
Code:
The name 'HelloWorldGenerated' does not exist in the current context
2 users thanked ndeslandes for this useful post.
Remco on 6/30/2021(UTC), UppSol on 6/30/2021(UTC)
Remco
#26 Posted : Tuesday, July 6, 2021 1:30:08 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
ndeslandes
#31 Posted : Tuesday, July 6, 2021 9:18:09 AM(UTC)
Rank: Member

Groups: Registered
Joined: 2/12/2014(UTC)
Posts: 10
Location: United Kingdom

Thanks: 2 times
Was thanked: 3 time(s) in 2 post(s)
Great, thanks Remco!

It worked fine on my solution. I'm just getting these warnings, but they don't seem to cause any issues:

Quote:

Microsoft.Net.Compilers Nuget package references are not currently supported by NCrunch.
ndeslandes
#32 Posted : Tuesday, July 6, 2021 9:29:25 AM(UTC)
Rank: Member

Groups: Registered
Joined: 2/12/2014(UTC)
Posts: 10
Location: United Kingdom

Thanks: 2 times
Was thanked: 3 time(s) in 2 post(s)
Quote:
Note that it presently isn't possible for NCrunch to instrument the source generating project or track code coverage in it.


Probably related, but another thing that's not working is that when a change is made to the generator, the "run impacted test" mode doesn't pick up the tests that need to be rerun.
Remco
#33 Posted : Tuesday, July 6, 2021 2:14:37 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
Thanks for confirming! I don't think the compiler packages warning is related to this work. If you aren't getting any errors, it's nothing to worry about. There are use cases related to the compiler packages that can cause NCrunch to bomb out with weird errors. If you aren't seeing these, then you can ignore the warning.

ndeslandes;15507 wrote:

Probably related, but another thing that's not working is that when a change is made to the generator, the "run impacted test" mode doesn't pick up the tests that need to be rerun.


This is to be expected. Right now we don't have a way to instrument the generator assemblies, as the build system for these projects doesn't seem to support having references to additional assemblies. You'll need to manually execute your tests after changing the source generator, or rely on the automatic/aggressive execution mode instead.

jschreuder
#27 Posted : Tuesday, July 6, 2021 11:59:39 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 10/5/2015(UTC)
Posts: 42
Location: Australia

Thanks: 14 times
Was thanked: 23 time(s) in 11 post(s)


Thanks Remco. Unrelated to source generators as I'm not using them, but on this build the engine process is crashing almost immediately after loading all projects (in both VS2019 and VS2021). I've submitted a bug report via the menu.
Remco
#28 Posted : Wednesday, July 7, 2021 12:58:26 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
jschreuder;15509 wrote:

Thanks Remco. Unrelated to source generators as I'm not using them, but on this build the engine process is crashing almost immediately after loading all projects (in both VS2019 and VS2021). I've submitted a bug report via the menu.


Thanks for sharing these reports. You may have just saved a great many people a lot of pain.

I'm sifting through the logs but cannot find a clear reason for why the engine process is crashing on you. I think this might be something more systemic. If this is still happening consistently for you, could you check the memory consumption of the process during your initialisation, and examine the contents of your windows event viewer to see if there is more detailed error information? I'm wondering if this might be an OutOfMemoryException or something similarly traumatic.

It would also be great if you could confirm whether this build of NCrunch works for you on different solutions (i.e. smaller ones). We aren't able to reproduce this issue on our side, so right now the focus is on narrowing it down. I really appreciate your help on this. I was hoping to release 4.9 today but will hold it back until we can be sure of shipping it without a critical crash issue.
jschreuder
#30 Posted : Wednesday, July 7, 2021 1:07:48 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 10/5/2015(UTC)
Posts: 42
Location: Australia

Thanks: 14 times
Was thanked: 23 time(s) in 11 post(s)
Remco;15510 wrote:
jschreuder;15509 wrote:

Thanks Remco. Unrelated to source generators as I'm not using them, but on this build the engine process is crashing almost immediately after loading all projects (in both VS2019 and VS2021). I've submitted a bug report via the menu.


Thanks for sharing these reports. You may have just saved a great many people a lot of pain.

I'm sifting through the logs but cannot find a clear reason for why the engine process is crashing on you. I think this might be something more systemic. If this is still happening consistently for you, could you check the memory consumption of the process during your initialisation, and examine the contents of your windows event viewer to see if there is more detailed error information? I'm wondering if this might be an OutOfMemoryException or something similarly traumatic.

It would also be great if you could confirm whether this build of NCrunch works for you on different solutions (i.e. smaller ones). We aren't able to reproduce this issue on our side, so right now the focus is on narrowing it down. I really appreciate your help on this. I was hoping to release 4.9 today but will hold it back until we can be sure of shipping it without a critical crash issue.


FWIW I've been using 4.9.0.1 for a couple of weeks in VS2019 with no issues, so maybe something in .2 / .3?

I'll try a reinstall and reboot, and also try on some smaller projects too and see if that helps.
1 user thanked jschreuder for this useful post.
Remco on 7/7/2021(UTC)
jschreuder
#29 Posted : Wednesday, July 7, 2021 1:26:03 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 10/5/2015(UTC)
Posts: 42
Location: Australia

Thanks: 14 times
Was thanked: 23 time(s) in 11 post(s)
Remco;15510 wrote:
jschreuder;15509 wrote:

Thanks Remco. Unrelated to source generators as I'm not using them, but on this build the engine process is crashing almost immediately after loading all projects (in both VS2019 and VS2021). I've submitted a bug report via the menu.


Thanks for sharing these reports. You may have just saved a great many people a lot of pain.

I'm sifting through the logs but cannot find a clear reason for why the engine process is crashing on you. I think this might be something more systemic. If this is still happening consistently for you, could you check the memory consumption of the process during your initialisation, and examine the contents of your windows event viewer to see if there is more detailed error information? I'm wondering if this might be an OutOfMemoryException or something similarly traumatic.

It would also be great if you could confirm whether this build of NCrunch works for you on different solutions (i.e. smaller ones). We aren't able to reproduce this issue on our side, so right now the focus is on narrowing it down. I really appreciate your help on this. I was hoping to release 4.9 today but will hold it back until we can be sure of shipping it without a critical crash issue.


Reinstall and reboot didn't help - I initially suspected it might be due to the file locking issue I got when installing originally but it seems not.

There's nothing in Event Viewer when the process ends, so maybe it's not crashing?

Memory usage seems unlikely - system memory is sitting at 40% used.

I have tried a couple of smaller solutions in 2022 and both work without any issue.

My other thought was that maybe it was a corrupt cache or something, so I wiped the NCrunch cache directory completely, but the issue still happens on this particular solution of about 90 projects. The .crunchsolution.cache file did get generated before the process dies if that helps?

Based on the UI, it seems like it's dying at the "building..." stage, at least based on what the tests panel is telling me.

I'm going to try .1/.2 in 2019 and see if that narrows it down at all for you
Remco
#34 Posted : Wednesday, July 7, 2021 1:40:12 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
Does setting your 'Max number of processing threads' setting to significantly lower value make any difference?
jschreuder
#35 Posted : Wednesday, July 7, 2021 2:02:00 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 10/5/2015(UTC)
Posts: 42
Location: Australia

Thanks: 14 times
Was thanked: 23 time(s) in 11 post(s)
Remco;15513 wrote:
Does setting your 'Max number of processing threads' setting to significantly lower value make any difference?


Unfortunately not. Setting this value to 1 did not seem to have any effect. I assume changing CPU cores assigned to NCrunch probably won't help either then?

I've tried all the combinations for older versions, here's the rundown:

VS2019
4.9.0.1 - working
4.9.0.2 - crashing
4.9.0.3 - crashing

VS2022
4.9.0.1 - N/A
4.9.0.2 - crashing
4.9.0.3 - crashing

So it looks like something between 4.9.0.1 and 4.9.0.2.

Contrary to my earlier bug report, VS2022 does appear to restart the engine process in a loop now. I'm not sure why it wasn't doing that when I first tried.

EDIT: I think I have made some sort of progress narrowing it down. Using a default .ncrunchsolution / .ncrunchsolution.user file does not produce the issue. I'll see if I can work out if it's a particular option.
jschreuder
#36 Posted : Wednesday, July 7, 2021 2:17:30 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 10/5/2015(UTC)
Posts: 42
Location: Australia

Thanks: 14 times
Was thanked: 23 time(s) in 11 post(s)
jschreuder;15514 wrote:
EDIT: I think I have made some sort of progress narrowing it down. Using a default .ncrunchsolution / .ncrunchsolution.user file does not produce the issue. I'll see if I can work out if it's a particular option.


Alright, I think I've narrowed it down. For this solution I'm using a custom build property TargetFrameworks = net48 to exclude any non-net48 projects from NCrunch and also skip cross-targeted netstandard building.
This was working ok in the earlier build but it seems like something is up with newer builds where this isn't working properly?

If I remove this setting (and only this setting) from .ncrunchsolution.user, the build engine doesn't crash or whatever it's doing. With it, it does.

Hope that helps @Remco!
Remco
#37 Posted : Wednesday, July 7, 2021 2:19:49 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
jschreuder;15515 wrote:
[quote=jschreuder;15514]
Alright, I think I've narrowed it down. For this solution I'm using a custom build property TargetFrameworks = net48 to exclude any non-net48 projects and also cross-targeted projects (netstandard / net48) from NCrunch.
This was working ok in early builds but it seems like something is up with newer builds where this isn't working properly?


Gotcha!!!

As you posted this, I was just writing up a reply with a theory that our settings file sync could be causing this, and I was going to lead you down a path of removing settings files to figure out which setting was causing the problem. You beat me to the punch.

This is making sense to me now. I'm going to try and build a use case to reproduce it.
2 users thanked Remco for this useful post.
jschreuder on 7/7/2021(UTC), UppSol on 7/7/2021(UTC)
Remco
#38 Posted : Thursday, July 8, 2021 8:25:22 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
2 users thanked Remco for this useful post.
jschreuder on 7/8/2021(UTC), UppSol on 7/9/2021(UTC)
jschreuder
#39 Posted : Thursday, July 8, 2021 11:19:07 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 10/5/2015(UTC)
Posts: 42
Location: Australia

Thanks: 14 times
Was thanked: 23 time(s) in 11 post(s)
2 users thanked jschreuder for this useful post.
Remco on 7/9/2021(UTC), UppSol on 7/9/2021(UTC)
mgrundner
#40 Posted : Thursday, January 27, 2022 9:14:43 PM(UTC)
Rank: Member

Groups: Registered
Joined: 2/25/2016(UTC)
Posts: 17
Location: Austria

Thanks: 4 times
Was thanked: 3 time(s) in 2 post(s)
Seams the problem is back with https://github.com/nicodeslandes/SourceGenApp and 4.11.0.2 in VisualStudio 2022 Preview :(
Remco
#41 Posted : Thursday, January 27, 2022 10:23:14 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
mgrundner;15949 wrote:
Seams the problem is back with https://github.com/nicodeslandes/SourceGenApp and 4.11.0.2 in VisualStudio 2022 Preview :(


We've had some odd reports with the new VS2022 preview build lately. I think they still have a bit of stuff in the oven with it. I recommend holding off on using it for the moment. We'll be doing an assessment on it closer to its release date.
Users browsing this topic
Guest
3 Pages<123>
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.235 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download