Open Ruchitha9177 opened 3 weeks ago
Can you share your csproj? Or at least the package references so we can see what versions of xbim you're picking up (include all dependencies)
It's looking like a clash of Microsoft.Extensions.Logging versions where there may have been breaking changes.
I've just tried it with xbim Essentials 6.0.445 (latest from Nuget) and 6.0.475-develop from Myget-develop
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Xbim.Essentials" Version="6.0.445" />
</ItemGroup>
</Project>
... and was able to open the IfcStore correctly (in net8) using exactly the same code.
My guess is you have an incompatible version of M.E.Logging included (perhaps transitively via another package).
Hint: Check what's loaded in Visual Studio using Debug->Windows->Modules
Thanks for your response, Yeah, I just tried with console application and there it is working fine. But when loading my whole solution then I'm facing this issue. I could see M.E.Logging version 8.0.0 and 8.0.1 in some other project of same solution. Will that be the issue for this exception? If we resolve this conflict, then do you think this issue will be resolved? or is this exception is because of some other issue? Below are snaps for reference.
Can you supply the actual csproj or at least the PackageReferences section? (in text form - not a screenshot)
The difference between 8.0.0 and 8.0.1 should not be an issue - MS won't be making breaking changes in patch versions. More likely to be an old 2.0, 1.1 ME.Logging sneaking in somewhere in another 3rd party library. Are you referencing any Revit API assemblies? (Have seen this cause the same issue)
We use central package system, so we don't provide version in csproj instead we do we do in other way. But Xbim Essentials I'm using 6.0.445. Below is my project called IFCReader.csproj where I've referring two other projects called Logging, Clipper Helper.
In logging project, we use both netcore3.1 and net6 so earlier it worked fine. Now I'm upgrading net6 to net8 and netcore3.1 remains same. Let me know if you need anything else.
Below is Logging.csproj in which we are using NLog.Web.AspNetCore version 5.3.12
This is image talking about different versions of logging project i.e., netcoreapp3.1 and net8
Not sure I can really help you without access to some code. The fact netcoreapp3.1 uses an older version seems a red herring- the issue is in net8 right?
Did you see my suggestion:
Hint: Check what's loaded in Visual Studio using Debug->Windows->Modules
i.e you can Check where the Logging assemblies are loading from and their versions, when debugging the net8 app.
Could you please let me know what version of system.private.corelib you are loading? I mean which .NET runtime version are you using? Can you quickly check?
I observed one difference. When i referred my actual project from console application it used 8.0.7 version, and I didn't see any issues. But when im debugging from my original project where 8.0.8 runtime is being loaded and issue is coming.
Below image using 8.0.8 and I'm seeing exception.
Could you please check if you are using which version runtime?
I have C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.5\System.Private.CoreLib.dll - but I guess I've not updated VS in a while
I also see you're building under Linux / WSL somehow.
If you look in your net8 build folder I suspect you have a stray version of Microsoft.Extension.Logging*.dll somehow - perhaps via the Nlog package. Have you tried adding Microsoft.Extension.Logging 8.0.x as an explicit dependency on your project?
I'm sorry I can't offer much else at this 'arms length' - given this looks like a commercial product perhaps reach out to me by email and we can look at some more formal support to help investigate. (email on my profile)
Yeah, correct I'm building project under Linux. Through console application I'm able to do IfcStore.Open without any issues. But from Linux project it is failing somehow.
I have tried adding Microsoft.Extension.Logging 8.0.x as an explicit dependency on my project and no luck.
If we're to help you're going to need to create some kind of minimal viable reproduction of the issue so we can narrow it down. As it is I think we've shown xbim Essentials is working in .net8 runtime fine. It's something in your environment that's causing this issue (e.g. assuming it works if you re-target net3.1/net6 again?)
Try to rule in / out a Linux issue Try to add all the packages you're using into the console app and see if you can reproduce / identify the package conflicting.
@Ruchitha9177 Did you make any resolution on this? Can we close?
Hi, no we are still struggling with the issue... But seems like the below two dependencies causing issue which xbim is referring internally Microsoft.Extensions.DependencyInjection 8.0.0 Microsoft.Extensions.DependencyInjection.Abstractions 8.0.1 This difference is somehow causing the conflict is what we are suspecting. Other projects are forcing Microsoft.Extensions.DependencyInjection.Abstractions to 8.0.1. Did you know anything on this?
Hi, you can close this...By forcefully making Microsoft.Extensions.DependencyInjection.Abstractions 8.0.0 throughout project worked.
Could you please help me to understand why it is not working with 8.0.1? Its working with 8.0.0 but not 8.0.1? With .net6 the same worked but net8 its showing issue with 8.0.1 Thanks!
Hi,
Could you please help me to understand why Microsoft.Extensions.DependencyInjection.Abstractions is not working with 8.0.1? Its working with 8.0.0 but not 8.0.1? With .net6 the same worked but net8 it shows issue with 8.0.1 which we are unable to understand..
Could you please help me to understand why Microsoft.Extensions.DependencyInjection.Abstractions is not working with 8.0.1? Its working with 8.0.0 but not 8.0.1? With .net6 the same worked but net8 it shows issue with 8.0.1 which we are unable to understand..
Honest answer: I don't know - hard to say without access to a project with the issue. The original problem you hit looks like a MissingMethodException building the xbim DI service provider - which indicates an incompatible dependency/ breaking change in interface.
Here's a theory: We're using ME.DependencyInjection & Abstractions 8.0.0 internally in xbim.Common (note we multi-target net6 and net8). If you've a third party dependency bringing in a different version ME.DependencyInjection.Abstractions it must be causing issues when resolving some types. But 8.0.1 and 8.0.0 should be compatible so there's something strange going on.
Did you or your team get any chance to use or test with "Microsoft.Extensions.DependencyInjection" 8.0.0 "Microsoft.Extensions.Logging.Abstractions" 8.0.1? Could you please check at your end with these versions of 8.0.0 and 8.0.1? Just to see if you are also facing this issue or not?
No I couldn't reproduce. See https://github.com/andyward/xbim.net8.tests/tree/main/xbim.net8.testproject
If you can get a version of this repo to break please share.
When run I get:
warn: Xbim.Ifc.IfcStore[0]
Using DI version 8.0.0.0 - File version 8.0.324.11423
info: Xbim.Ifc.IfcStore[0]
Found 75 products
I've tried attempting my project to .NET8 using Xbim.Essentials 6.0.445.
I'm facing issue while opening the file using IFCStore.open();
GetSchemaVersion is to just check if its supported format or not like IFC2*3, IFC4 and its showing proper value. Here store value is coming as null. Exception is coming as below...
System.MissingMethodException: Method not found: 'Microsoft.Extensions.DependencyInjection.ServiceProvider Microsoft.Extensions.DependencyInjection.ServiceCollectionContainerBuilderExtensions.BuildServiceProvider(Microsoft.Extensions.DependencyInjection.IServiceCollection)'. at Xbim.Common.Configuration.XbimServices.b__18_0()
at System.Lazy
1.ViaFactory(LazyThreadSafetyMode mode) at System.Lazy
1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor) at System.Lazy`1.CreateValue() at Xbim.Common.Configuration.XbimServices.get_ServiceProvider() at Xbim.Ifc.IfcStore..ctor() at Xbim.Ifc.IfcStore.Open(Stream stream, StorageType dataType, XbimSchemaVersion schema, XbimModelType modelType, XbimEditorCredentials editorDetails, XbimDBAccess accessMode, ReportProgressDelegate progDelegate, Int32 codePageOverride)In output window Microsoft.Extensions.Logging.Abstractions.dll'. Cannot find or open the PDB file. Exception thrown: 'System.MissingMethodException' in System.Private.CoreLib.dl
Any help on this? Is there anything that i'm missing?