soziapath
soziapath
CC#
Created by soziapath on 4/26/2024 in #help
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.
98 replies
CC#
Created by soziapath on 3/1/2024 in #help
C#, Process Memory slowly going up but snapshots not indicating memory leak
No description
24 replies
CC#
Created by soziapath on 10/28/2023 in #help
❔ Roslyn compilation error (dynamic keyword)
Hello everyone, I'm pretty new to C# and had to start using it due to my new job. In the project i'm working on we use quite a lot of autogenerated code that is compiled using roslyn. So I decided to look at it some more and try using it in a couple example projects. But I've encountered a problem compiling code in roslyn that uses dynamic objects. The following code gives the compile error:
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Dynamic;

namespace Autogenerated;
public class _t1
{
private dynamic _wrappedObject;
public _t1(object wrappedObject)
{
_wrappedObject = wrappedObject;
}
public void Test()
{
_wrappedObject.Test();
}
public void Some()
{
_wrappedObject.Some();
}
}
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Dynamic;

namespace Autogenerated;
public class _t1
{
private dynamic _wrappedObject;
public _t1(object wrappedObject)
{
_wrappedObject = wrappedObject;
}
public void Test()
{
_wrappedObject.Test();
}
public void Some()
{
_wrappedObject.Some();
}
}
And the error message is:
(9,13): error CS1980: Cannot define a class or member that utilizes 'dynamic' because the compiler required type 'System.Runtime.CompilerServices.DynamicAttribute' cannot be found. Are you missing a reference?
(9,13): error CS1980: Cannot define a class or member that utilizes 'dynamic' because the compiler required type 'System.Runtime.CompilerServices.DynamicAttribute' cannot be found. Are you missing a reference?
10 replies