Hi,
I added Carter to a net console app and it wont run because newtonsoft which is a reference hasnt got copy local
Some of the carter references have a copy local, so Im not sure if I should add the reference myself.
Cheers,
John
Hi,
I added Carter to a net console app and it wont run because newtonsoft which is a reference hasnt got copy local
Some of the carter references have a copy local, so Im not sure if I should add the reference myself.
Cheers,
John
If i add the reference at runtime I get
Unhandled Exception: System.InvalidOperationException: Cannot find library information for Newtonsoft.Json/12.0.1
at Microsoft.Extensions.DependencyModel.DependencyContextJsonReader.CreateLibrary(TargetLibrary targetLibrary, Boolean runtime, Dictionary2 libraryStubs) at Microsoft.Extensions.DependencyModel.DependencyContextJsonReader.<>c__DisplayClass20_0.<CreateLibraries>b__0(TargetLibrary property) at System.Linq.Enumerable.SelectListIterator
2.MoveNext()
at System.Linq.Enumerable.WhereEnumerableIterator1.MoveNext() at System.Linq.Enumerable.CastIterator[TResult](IEnumerable source)+MoveNext() at System.Collections.Generic.LargeArrayBuilder
1.AddRange(IEnumerable1 items) at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable
1 so
This is the sample
CarterHelloWorldWebApp.zip (781.8 KB)
Curious. Coy Local should propagate down into all dependencies, but from the color, it looks like the Json package is also pulled in from something else beside the Carter ref, and thatās probably the problem (Iāll check tomorrow, the fix will probably be to also propagate CopyLocal for references already added by something elseā¦
Yes I think thats it.
Carter 3.10.0 references newtonsoft 12.01 and some aspnetcore references reference 10.0.1
Yeah, if the main runtime package pulls it in, it wonāt be set to copy local (else, everything would be copy local). this seems the correct behavior, Iām. to sure how handling this different would be feasible.
Reproduced that the project failed on Resolve w/o an error (as the other thread hinted at); thatās a bug, fixed now and your project builds for me. Fix isn;t in time for 2363 which is out now, but Iāll do a new build for you i a bit.
What confuses me is that in have two bug reports for you, using the same test case project, one says āproject doesnt buildā (fixed as discussed), and the other says it fails with a runtime error on a missing .dll.
How could get the the latter, of the project failed to build!?
It went like this
It looks like ebuild is still picking up newtonsoft 12.01 because carter 3.11 is installed so it picked that one. I dont think it should do that because Ive specified [11.0.2] of newtonsoft
I still believe that any nuget references I add should add [] around the version so its more predictable.
Most of the time Ive been editing the elements file myself and doing that.
Probably should, when specifying a version, yeah. will change.
I think I worked where this comes from
Unhandled Exception: System.InvalidOperationException: Cannot find library information for Newtonsoft.Json/12.0.1
at
Building a project with the lowercase one adds a newtonsoft entry to the libraries section of deps.json file. The uppercase one doesnt and when you run the app you get that exception.
I think I reported that case issue in the dialog before but I cant find it.
I think the lowercase one comes from the libraries/application support/remobjects software/ebuild/packges/nuget/newtonsoft.json/11.0.2
I actually havent got 11.0.2 in my nuget folder so I wouldnt expect the project to build ?
It seems to pull it straight from the cache. Is it meant to do that ?
Probably, yes, the cache uses now all lowercase folder names, as thats what MSās own cache does too. I changed that so we can use it interchangeably in the .dev.json file.
You tell me. the build output would tel you what reference itās using? maybe it got upgraded?
Iām not sure what you mean by that?
my guess whats happening is this: some name checks in EBuild are (thats a bug I guess) not properly case insensitive. the main package pulls in āNewtonsoft.Jsonā, and then your own reference is ānewtonsoft.jsonā, and due to the case difference, it gets treated as different package, pulled in again, and added to the reps (dependencies from the main package do not get added there, nor should they be).
Iāll try and fix that (your project as a testcase would be appreciated), but it wonāt fix your problem, because then weāll have NewtonSoft.json not go into .deps file at all. No idea why it should.
God, what a f**king mess Microsoft has made here.
Iāve fixed the case issue; Iāll send you a new version when itās built (a full new Fire build, for the other thread, will be later in the day). Will be curious to see how it behaves now, also, test case still appreciated for the second part of the issue
Thanks. Sorry whats the test case for ?
For:
assuming thats still a problem for you with the new version.
New build is up.
NewtonCaseConsoleApplication.zip (589.6 KB)
This is the testcase for the casing issue. deps.json is missing the newtonsoft entries in the libraries section.
If I run this I get
Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly āNewtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeedā. The located assemblyās manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Abort trap: 6
Having the package in library or not makes no difference to me, ki always get
Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
I get this whether the reference is copy-local or not (and note, its a different error than what we had before. this is not a missing .dll per se ā it finds the .dll, it just doesnāt like it, for some reason.
@ck, any ideas?
this probably needs one of those version rewrites. Vresion range [0ā¦x] -> Exact version. the one you have isnāt 12.0
Reference: /Users/mh/Library/Application Support/RemObjects Software/EBuild/Packages/NuGet/newtonsoft.json/12.0.1/lib/netstandard2.0/Newtonsoft.Json.dll
and thatās the version it copy-localsā¦
Fixed.
What was the issue ?