Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.ServiceModel.InstanceContextMode not found in System.ServiceModel.Primitives (8.0.0, and lower) nuget package #5637

Open
kankman opened this issue Aug 26, 2024 · 2 comments
Assignees
Labels

Comments

@kankman
Copy link

kankman commented Aug 26, 2024

I added the nuget package "system.servicemodel.primitives" (8.0.0). The enum InstanceContextMode is not present there.

The source Code of the enum is here InstanceContextMode.cs on git . The decompiled source of the dll in lib folder of the nuget package looks the same (everything right).

I found out, that the file used in the project is in ref folder not in lib. The file sizes differ extremely:
In ref folder: 113KB
In lib folder: 2.28MB

@mconnew
Copy link
Member

mconnew commented Sep 6, 2024

This is a due to a problem we're working on where types are being documented from our implementation assembly instead of our reference assembly. We have some types semi ported (or in the case of an enum, fully as there's no implementation with enums) to help keep the code as similar as possible between .NET Framework and .NET. This makes it easier and more reliable to decide if any security fixes need to be ported over in either direction. InstanceContextMode is in this category. The class DispatchRuntime is common between client and server code on .NET Framework. When you have a service, you can specify the InstanceContextMode which is used to provide a default implementation of IInstanceContextProvider. There's effectively a factory method which gets passed the configured InstanceContextMode which returns the appropriate IInstanceContextProvider instance. On the client code path for DispatchRuntime, this factory method is passed InstanceContextMode.PerSession so the factory method will always provide the same concrete type. We could have striped out the enum and removed it from the method call, but as much code was ported without changes as possible.

In client scenarios, as far as I'm aware (I did check in case there was a scenario I wasn't aware of but I couldn't find anything) InstanceContextMode can't affect any behavior in a WCF client. Why do you need it? If there's a usage scenario I've missed, we can make evaluate enabling that scenario.

@kankman
Copy link
Author

kankman commented Sep 7, 2024

We are currently porting our Net Framework Projects to Net8 to. WE have a lot of wcf services hosted and I wanted to host them in NetFramework as WCF for downward compatibility and as REST. I wanted them to use the same interfaces for WCF and REST and use them for their clients as well. The WCF Hosting infos in the Interfaces are not necessary for the clients.

After a lot of trouble with the "Mixed Hosting" of both, we decided to only use REST Services and also migrate all at once.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants
@mconnew @HongGit @kankman and others