C
C#soziapath

System.Private.ServiceModel not found

I've been using a library for opcua and haven't had any problems until now, didn't change anything in dependencies, but suddenly, I get the error during runtime that the System.Private.ServiceModel is not found. When I add a reference to the exact same version as the one that the error message is indicating, it is telling me that there is a conflict:
Severity Code Description Project File Line Suppression State
Error NU1605 Warning as Error: A downgrade of the "System.Private.ServiceModel" package from 4.5.3 to 4.5.1 has been detected. Refer directly from the project to the package to select a different version.
MyProject -> MyProject.Shared -> Opc.UaFx.Advanced 2.41.1 -> System.ServiceModel.Primitives 4.5.3 -> System.Private.ServiceModel (>= 4.5.3)
Severity Code Description Project File Line Suppression State
Error NU1605 Warning as Error: A downgrade of the "System.Private.ServiceModel" package from 4.5.3 to 4.5.1 has been detected. Refer directly from the project to the package to select a different version.
MyProject -> MyProject.Shared -> Opc.UaFx.Advanced 2.41.1 -> System.ServiceModel.Primitives 4.5.3 -> System.Private.ServiceModel (>= 4.5.3)
I honestly have no idea what the problem is, I've had a similiar problem before with System.IO.Ports, but that somehow dissapeared at some point. When I do a clean build without the reference to System.Private.ServiceModel, I also don't get the dll in the output directory, despite it being referenced by the other package, and if I look at older releases, the dll was always present. This has been bugging me for a whole day and the only workaround is to manually copy the dll or add the dll to the project (which in my opinion is ugly as hell) Hope somebody might know what the problem could be. Thanks in advance.
R
reflectronic19d ago
is this the full error? i think there is supposed to be more text
S
soziapath19d ago
The only additional thing after is the project files that cause it, basically the same line as MyProject -> ... but with the .csproj suffix
R
reflectronic19d ago
the error does not make sense. it does not show what is downgrading System.Private.ServiceModel to 4.5.1 it is uspposed to show the two different paths to System.Private.ServiceModel that resolve to different versions
S
soziapath19d ago
Ah, yeah, sorry my bad, didn't see the difference in there
Severity Code Description Project File Line Suppression State
Error NU1605 Warning as Error: A downgrade of the "System.Private.ServiceModel" package from 4.5.3 to 4.5.1 has been detected. Refer directly from the project to the package to select a different version.
ProjectA -> ProjectA.Shared -> AdvancedLibrary 2.41.1 -> System.ServiceModel.Primitives 4.5.3 -> System.Private.ServiceModel (>= 4.5.3)
ProjectA -> ProjectA.Shared -> System.Private.ServiceModel (>= 4.5.0.3) ProjectA [path]\ProjectA.csproj
Severity Code Description Project File Line Suppression State
Error NU1605 Warning as Error: A downgrade of the "System.Private.ServiceModel" package from 4.5.3 to 4.5.1 has been detected. Refer directly from the project to the package to select a different version.
ProjectA -> ProjectA.Shared -> AdvancedLibrary 2.41.1 -> System.ServiceModel.Primitives 4.5.3 -> System.Private.ServiceModel (>= 4.5.3)
ProjectA -> ProjectA.Shared -> System.Private.ServiceModel (>= 4.5.0.3) ProjectA [path]\ProjectA.csproj
R
reflectronic19d ago
System.Private.ServiceModel (>= 4.5.0.3)
it seems like you meant to write 4.5.3 not 4.5.0.3 yes, the assembly version might be 4.5.0.3. but what matters here is the package version, not the assembly version the package 4.5.3 contains the assembly version 4.5.0.3. they are different for reasons
S
soziapath19d ago
okay, then at least that is resolved, but the question remains, why I need to add the reference in the first place, since the library has it as dependency
R
reflectronic19d ago
i don't know
S
soziapath19d ago
Okay, I added it as reference with Version 4.5.3, but I still don't get the dll in the output
R
reflectronic19d ago
it shows up in my output when i reference Opc.UaFx.Advanced under runtimes/
S
soziapath19d ago
same for me, but not in the root output directory, which seems to be required? Still get the error unless I copy it manually to the same path as the executable
R
reflectronic19d ago
do you not have a ProjectA.deps.json file in your build output
S
soziapath19d ago
I do have that dependency file and it contains the Dependency
"System.Private.ServiceModel/4.5.3": {
"dependencies": {
"Microsoft.NETCore.Platforms": "3.1.0",
"System.Reflection.DispatchProxy": "4.5.0",
"System.Security.Principal.Windows": "4.7.0"
},
"runtimeTargets": {
"runtimes/unix/lib/netstandard2.0/System.Private.ServiceModel.dll": {
"rid": "unix",
"assetType": "runtime",
"assemblyVersion": "4.5.0.3",
"fileVersion": "4.6.26720.1"
},
"runtimes/win/lib/netstandard2.0/System.Private.ServiceModel.dll": {
"rid": "win",
"assetType": "runtime",
"assemblyVersion": "4.5.0.3",
"fileVersion": "4.6.26720.1"
}
}
},
"System.Private.ServiceModel/4.5.3": {
"dependencies": {
"Microsoft.NETCore.Platforms": "3.1.0",
"System.Reflection.DispatchProxy": "4.5.0",
"System.Security.Principal.Windows": "4.7.0"
},
"runtimeTargets": {
"runtimes/unix/lib/netstandard2.0/System.Private.ServiceModel.dll": {
"rid": "unix",
"assetType": "runtime",
"assemblyVersion": "4.5.0.3",
"fileVersion": "4.6.26720.1"
},
"runtimes/win/lib/netstandard2.0/System.Private.ServiceModel.dll": {
"rid": "win",
"assetType": "runtime",
"assemblyVersion": "4.5.0.3",
"fileVersion": "4.6.26720.1"
}
}
},
UU
Unknown User19d ago
S
soziapath19d ago
I think that would be too much work to pseudonymize all the names while still keeping it functional^^
UU
Unknown User19d ago
S
soziapath19d ago
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<BaseOutputPath>..\..\..\bin</BaseOutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<UseWPF>True</UseWPF>
<PlatformTarget>AnyCPU</PlatformTarget>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<IsTestProject>true</IsTestProject>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.0" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
<PackageReference Include="Opc.UaFx.Advanced" Version="2.41.1" />
<PackageReference Include="System.Private.ServiceModel" Version="4.5.3" />
<PackageReference Include="pythonnet" Version="3.0.3" />
<PackageReference Include="Syncfusion.Shared.WPF" Version="20.3.0.49" />
<PackageReference Include="Syncfusion.Themes.Metro.WPF" Version="20.3.0.49" />
<PackageReference Include="System.IO.Ports" Version="7.0.0" />
</ItemGroup>


</Project>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<BaseOutputPath>..\..\..\bin</BaseOutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<UseWPF>True</UseWPF>
<PlatformTarget>AnyCPU</PlatformTarget>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<IsTestProject>true</IsTestProject>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.0" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
<PackageReference Include="Opc.UaFx.Advanced" Version="2.41.1" />
<PackageReference Include="System.Private.ServiceModel" Version="4.5.3" />
<PackageReference Include="pythonnet" Version="3.0.3" />
<PackageReference Include="Syncfusion.Shared.WPF" Version="20.3.0.49" />
<PackageReference Include="Syncfusion.Themes.Metro.WPF" Version="20.3.0.49" />
<PackageReference Include="System.IO.Ports" Version="7.0.0" />
</ItemGroup>


</Project>
UU
Unknown User19d ago
R
reflectronic19d ago
i am certainly able to load it
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<OutputType>Exe</OutputType>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Opc.UaFx.Advanced" Version="2.41.1" />
</ItemGroup>

</Project>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<OutputType>Exe</OutputType>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Opc.UaFx.Advanced" Version="2.41.1" />
</ItemGroup>

</Project>
using System.Collections.Generic;

Console.WriteLine("Hello World!");

var m = new SynchronizedCollection<int>();
m.Add(100);

Console.WriteLine(string.Join(',', AppDomain.CurrentDomain.GetAssemblies().Select(a => a.GetName().Name)));
using System.Collections.Generic;

Console.WriteLine("Hello World!");

var m = new SynchronizedCollection<int>();
m.Add(100);

Console.WriteLine(string.Join(',', AppDomain.CurrentDomain.GetAssemblies().Select(a => a.GetName().Name)));
prints out System.Private.ServiceModel among other things
UU
Unknown User19d ago
R
reflectronic19d ago
yes, it works fine
UU
Unknown User19d ago
R
reflectronic19d ago
what is the call stack when you hit this file not found error
S
soziapath19d ago
Ah, sorry, this was the ProjectA.Shared, this is the projectA.csproj:
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<BaseOutputPath>..\..\..\bin</BaseOutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\ProjectA.Shared.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.0.0" />
<PackageReference Include="MVTec.HalconDotNet-Windows" Version="22112.0.0" />
<PackageReference Include="Syncfusion.Shared.WPF" Version="20.3.0.49" />
<PackageReference Include="Syncfusion.Themes.Metro.WPF" Version="20.3.0.49" />
</ItemGroup>

</Project>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<BaseOutputPath>..\..\..\bin</BaseOutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\ProjectA.Shared.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.0.0" />
<PackageReference Include="MVTec.HalconDotNet-Windows" Version="22112.0.0" />
<PackageReference Include="Syncfusion.Shared.WPF" Version="20.3.0.49" />
<PackageReference Include="Syncfusion.Themes.Metro.WPF" Version="20.3.0.49" />
</ItemGroup>

</Project>
Ah, is just replaced the sensitive stuff with bullshit and let chatgpt make it pretty, guess it replaced opcua as well. AdvancedLibrary is opc.uafx.advanced
UU
Unknown User19d ago
R
reflectronic19d ago
the restore error has been fixed but there is still a file not found error at runtime
UU
Unknown User19d ago
S
soziapath19d ago
I'll try to see if i can get a stacktrace
UU
Unknown User19d ago
S
soziapath19d ago
Not my decision sadly, company uses that and would probably break shit it we updated to a newer version
UU
Unknown User19d ago
S
soziapath19d ago
Honestly, I'm still pretty new to C# in general, never had the time to really understand all the ins and outs, since I had to jump straight into the project... Stack Trace seems to be pretty empty...
UU
Unknown User19d ago
S
soziapath19d ago
yeah, mostly external code it seems
UU
Unknown User19d ago
R
reflectronic19d ago
yes, the external code is what matters here
S
soziapath19d ago
R
reflectronic19d ago
ok. well, nothing seems suspicious there it is possible to debug this further but i think it will be easier to try this: delete the reference to System.Private.ServiceModel instead, add a reference to
<PackageReference Include="System.ServiceModel.Primitives" Version="6.0.0" />
<PackageReference Include="System.ServiceModel.Primitives" Version="6.0.0" />
the newer version of the package is put together in a less unconventional way, so whatever is causing this issue might not have a chance to do the wrong thing
S
soziapath19d ago
Thanks a lot for the help! Will try that now... Still the same error
R
reflectronic19d ago
that System.Private.ServiceModel is not found? that does not make sense. it does not exist with the 6.0.0 version of the package
S
soziapath19d ago
It still seems to be part of the dependencies in the deps.json, I deleted the build folder, output folder, did a clean and a clean build, still seems to appear in the deps.json
R
reflectronic19d ago
it is definitely not part of mine. the word private doesn't show up anywhere
<BaseOutputPath>..\..\..\bin</BaseOutputPath>
just to be clear, the two build outputs do not go into the same folder, right
S
soziapath19d ago
they do go to the same folder
R
reflectronic19d ago
._. that is entirely wrong tht should never be done it would explain these inexplicable issues, because it just means one build will randomly overwrite the other based on which one happens first
UU
Unknown User19d ago
R
reflectronic19d ago
at the very least, it needs to be explained what it's for...
S
soziapath19d ago
honestly, i think nobdody really had any idea what they were doing. I just recently started working at the company and it's honestly baffling, even my private projects have better structure, testing, etc. But since I'm still pretty new to c#, .net, msbuild etc, I'm not really in for improving things, just wanna finish the current project and then maybe/hopefully have some time for general improvements.
UU
Unknown User19d ago
R
reflectronic19d ago
i guess, i just don't understand how this part is possible here is my project:
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<OutputType>Exe</OutputType>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Opc.UaFx.Advanced" Version="2.41.1" />
<PackageReference Include="System.ServiceModel.Primitives" Version="6.0.0" />
</ItemGroup>

</Project>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<OutputType>Exe</OutputType>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Opc.UaFx.Advanced" Version="2.41.1" />
<PackageReference Include="System.ServiceModel.Primitives" Version="6.0.0" />
</ItemGroup>

</Project>
UU
Unknown User19d ago
R
reflectronic19d ago
and here is the only reference to System.ServiceModel in my deps.json:
"System.ServiceModel.Primitives/6.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-uGyB5FMdwiBmSgJtB0x9mWUuGYj/RbXjh8I6FtsZmUAVcFc6qjOasHPHnflHUk+Qqbx7cAFugDUa2HFRtDe1QA==",
"path": "system.servicemodel.primitives/6.0.0",
"hashPath": "system.servicemodel.primitives.6.0.0.nupkg.sha512"
}
"System.ServiceModel.Primitives/6.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-uGyB5FMdwiBmSgJtB0x9mWUuGYj/RbXjh8I6FtsZmUAVcFc6qjOasHPHnflHUk+Qqbx7cAFugDUa2HFRtDe1QA==",
"path": "system.servicemodel.primitives/6.0.0",
"hashPath": "system.servicemodel.primitives.6.0.0.nupkg.sha512"
}
UU
Unknown User19d ago
R
reflectronic19d ago
do you have System.ServiceModel.Primitives/6.0.0? if you do not have System.ServiceModel.Primitives/6.0.0, and you are sure you added the right package reference, then are you sure you are looking at the right deps.json file?
UU
Unknown User19d ago
Want results from more Discord servers?
Add your server
More Posts
✅ Please let me know if you have used VS 2022 before✅ validation pageHow do i make a page link to validation scripts for client side form validation. but no other pages,Blazor Project HierarchyI currently have a server only Blazor project and I am trying to sorta start from scratch by making Dealing with sub-models in request endpoint response patternI'm using RERP (request endpoint response) pattern to structure my api endpoints. Recently I've noti✅ Many-to-many relationship using Entity FrameworkCan I implement a many-to-many relationship using Entity Framework but using a custom intermediary e✅ Using UTF-8 encodingI got a very specific problem. Im writting an aplication in serbian. This is the main method public ✅ Multiplatform UIHello, I am a new c# user. I'd like to build multiplatform gui apps. I was going for MAUI but I see Start an app on fullSreem on macI did this for Windows ``` .ConfigureLifecycleEvents(events => { #if WINDOWS I'm getting a red squiggly line under alphabet.IndexOf() and I don't understand what is the problemI was converting my python code to C# code to see my skill in both and I got a issue on the alphabetCompiling and outputing code as a .dlll during runtimeI have this code but its giving me compilations error ``` (8,17): error CS0012: The type 'Object' iModernizing double loops in C#?In C#, concerning an IEnumerable, is there a better way to handle searching? The code is currently Search in database for more then one column (EFCore, Postgresql)Hello ```csharp if (!string.IsNullOrWhiteSpace(query.Search)) { var searchTxt = $"%{query.SearHow to Read byte by byte until EOF?Hello! I couldn't find an answer on the internet on this question so I guess I will have to ask it. Help binary trees BSThi guys, is there someone available to help me with binary trees and binary search trees ? Thank you✅ ObjectDisposedException without explicit traceHello, I'm getting exception at different moment, but I don't really understand what is happening. T✅ Renaming Model interferes with API controller creationI had a model named Venture that I renamed to Portfolio because I needed another model named Venture✅ Getting a single value in sql dbI am currently making a information system for our project in school and I am stuck at the login par✅ red x on win forms✅ Strange version error with EF.CoreI have a third party exe that references assembly `CTSCore.dll`. It seems to run fine, and when I exRandom temperature curve generation too biasedI'm trying to create a system for a game that would randomize temperature. Not fully randomly, thoug