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

Notification

Icon
Error

FrameworkReference Build Error on a netcoreapp2.1 Target Build
Silvenga
#1 Posted : Thursday, January 2, 2020 5:20:18 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 1/24/2016(UTC)
Posts: 40
Location: United States of America

Was thanked: 3 time(s) in 3 post(s)
Sorry, this is actually what I was coming here is ask about - https://forum.ncrunch.ne...nException-Looping.aspx was just a minor annoyance I've been encounting for months that made it hard to make a test case for this issue.

Something odd is happening with a csproj that looks like this:

Code:
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFrameworks>netcoreapp2.1;netcoreapp3.0</TargetFrameworks>
  </PropertyGroup>

  <ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.0'">
    <PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="3.0.0" />
  </ItemGroup>

  <ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1'">
    <PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="2.1.0" />
  </ItemGroup>

</Project>


The build for netcoreapp3.0 succeeds, but the build for netcoreapp2.1 fails with:

Code:
NCrunch: If you are experiencing problems in getting this project to build, have a look at http://www.ncrunch.net/documentation/troubleshooting_project-build-issues
NCrunch: This project was built on server '(local)'
C:\Program Files\dotnet\sdk\3.1.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets: The FrameworkReference 'Microsoft.AspNetCore.App' was not recognized


Which seems supper odd, considering this is a .Net Core 2.1 project, before FrameworkReference existed.

Digging deeper, it appears this build target is failing only if netcoreapp3.0 is included in the framework target list. This makes me think NCrunch is possibly leaking project build state (if that's a thing) between target builds.
Remco
#2 Posted : Friday, January 3, 2020 11:43:48 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 sharing this problem.

Quote:
Which seems supper odd, considering this is a .Net Core 2.1 project, before FrameworkReference existed.


Unfortunately, the new tooling introduced with .NET Core 3.0 has replaced the existing build system for .NET Core 2.1. Merely by having the new tooling installed, your system for 2.1 will also change.

I'm not completely sure what is happening here. The build system is doing something very unexpected under the hood here. We'll need to do some digging to try and figure this out. The good news is that we're able to reproduce the issue consistently using your code sample, so hopefully it should just be a matter of time.
michaelkroes
#3 Posted : Monday, January 6, 2020 7:12:28 PM(UTC)
Rank: NCrunch Developer

Groups: Registered
Joined: 9/22/2017(UTC)
Posts: 306
Location: Netherlands

Thanks: 138 times
Was thanked: 73 time(s) in 69 post(s)
Silvenga
#4 Posted : Thursday, April 9, 2020 8:41:51 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 1/24/2016(UTC)
Posts: 40
Location: United States of America

Was thanked: 3 time(s) in 3 post(s)
Sorry, the holidays and the resulting context switch had me space on this.

I did try those builds (3 months ago), no change. I've since updated to newer release, and the issue does still exist. It's not 100% consistent though, and sometimes works. I think it's related to https://forum.ncrunch.ne...nException-Looping.aspx - since it only occurs after csproj modifications.
Remco
#5 Posted : Saturday, April 11, 2020 4:03:44 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)
Silvenga;14596 wrote:
Sorry, the holidays and the resulting context switch had me space on this.

I did try those builds (3 months ago), no change. I've since updated to newer release, and the issue does still exist. It's not 100% consistent though, and sometimes works. I think it's related to https://forum.ncrunch.ne...nException-Looping.aspx - since it only occurs after csproj modifications.


I'm sorry to hear this. Do you have a sample solution you can share with us that can reproduce the problem, even inconsistently? You can submit small sample projects in ZIP form through the NCrunch contact form.

It may also be worth clearing out the 'obj' directories under your projects to see if that resolves the inconsistency. It could be old data doing this to you.
Silvenga
#6 Posted : Tuesday, April 14, 2020 8:13:30 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 1/24/2016(UTC)
Posts: 40
Location: United States of America

Was thanked: 3 time(s) in 3 post(s)
I'll try to make a small repo case, thanks.
Silvenga
#7 Posted : Monday, April 20, 2020 7:26:12 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 1/24/2016(UTC)
Posts: 40
Location: United States of America

Was thanked: 3 time(s) in 3 post(s)
I've managed to create 4 reproduction cases relevant to this. I've uploaded a ZIP.
Remco
#8 Posted : Monday, April 20, 2020 11:53:46 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 sending these through. I'll take a look and will get back to you as soon as I have more information.
Remco
#9 Posted : Wednesday, April 22, 2020 2:35:28 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)
Silvenga
#10 Posted : Friday, May 29, 2020 3:01:58 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 1/24/2016(UTC)
Posts: 40
Location: United States of America

Was thanked: 3 time(s) in 3 post(s)
I am so sorry, I never got a notification email from YAF. I just dropped by wondering how that investigation was going.

I tried the builds, same issue.

Code:

NCrunch: This project was built on server '(local)'
System.Exception: An exception was thrown in the remote environment: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> nCrunch.Common.UserException: Errors occurred while trying to load the project file: 
The FrameworkReference 'Microsoft.AspNetCore.App' was not recognized
   at nCrunch.Compiler.ComponentAnalysisContext.()
   at nCrunch.Compiler.ComponentAnalysisContext.AnalyseComponentBuild()
   at nCrunch.Compiler.RemoteBuildRunner.AnalyseComponentBuild(ComponentLoadParameters parameters)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at nCrunch.TaskRunner.Ipc.IpcMessageProcessor.(CallMethodMessage )
   at nCrunch.TaskRunner.Ipc.IpcMessageProcessor.ProcessMessageReturningResult(Byte[] data)
   at nCrunch.TaskRunner.Ipc.RemoteInstance.(Byte[] )
   at nCrunch.TaskRunner.Ipc.RemoteInstance.Invoke(IMessage msg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at nCrunch.Compiler.IRemoteBuildRunner.AnalyseComponentBuild(ComponentLoadParameters parameters)
   at nCrunch.Core.BuildManagement.BuildProcessLauncher..(IRemoteBuildRunner )
   at nCrunch.Core.BuildManagement.BuildProcessLauncher.(Action`1 , FilePath , String , ExternalProcess )
   at nCrunch.Core.BuildManagement.BuildProcessLauncher.(Action`1 , EffectiveProcessorArchitecture , GridClientId , BuildSystemParameters , IList`1 , Nullable`1 , GridAddress )
   at nCrunch.Core.BuildManagement.BuildProcessLauncher.AnalyseComponentBuildInExternalProcess(ComponentLoadParameters parameters, IList`1 customEnvironmentVariables)
   at nCrunch.Client.ComponentLoader.SnapshotComponentLoader.(EffectiveProcessorArchitecture , String )
   at nCrunch.Client.ComponentLoader.SnapshotComponentLoader.CreateComponentFromXml(FilePath projectFilePath, ParsedBuildXml projectXml, FilePath solutionFilePath, String[] additionalFilesToIncludeAtSolutionLevel, Boolean isLoadedFromFile, VisualStudioVersion vsVersion, ComponentUniqueName componentName, TaskSettings componentTaskSettings, Exception parseException, String targetFramework)


Well, also a good time to remember I needed to renew.
Remco
#11 Posted : Saturday, May 30, 2020 12:09:51 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)
Silvenga
#12 Posted : Monday, June 1, 2020 2:43:54 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 1/24/2016(UTC)
Posts: 40
Location: United States of America

Was thanked: 3 time(s) in 3 post(s)
Tentatively, looks like 4.4.0.9 resolves the bug, I can no longer reproduce it by modifying the csproj.

I've been committing a lot of broken tests over the past couple of months, because the status icon was permanently in a fail state, so very happy to finally see green again.
Silvenga
#13 Posted : Monday, June 1, 2020 2:45:43 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 1/24/2016(UTC)
Posts: 40
Location: United States of America

Was thanked: 3 time(s) in 3 post(s)
Also, my issues with the new optimized mode have been resolved.
1 user thanked Silvenga for this useful post.
Remco on 6/2/2020(UTC)
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.076 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download