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

svcutil: System.NullReferenceException while generating duplex client #4736

Closed
lipchev opened this issue Oct 7, 2021 · 3 comments
Closed

Comments

@lipchev
Copy link

lipchev commented Oct 7, 2021

Describe the bug
I'm receiving a System.NullReferenceException (here) while attempting to generate a duplex proxy in a .net5.0 project.

It seems like the "referenceKey" field that is being targeted here is actually named s_referenceKey.

To Reproduce

  1. In Visual Studio 2019: adding a reference to a duplex service (using the connected services wizard) produces no errors/warnings, but the generated proxy contains invalid annotations: [Microsoft.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.3-preview3.21351.2")]
  2. Running the command using the same tool version: dotnet-svcutil -u "Connected Services\ChemTypesService" --verbosity Debug lead me to:
    [29020.20] Importing metadata ... Error: Object reference not set to an instance of an object.
  3. Finally, I got the trace from running the generated SvcutilBootstrapper project.
    " at Microsoft.Tools.ServiceModel.Svcutil.CodeDomHelpers.get_ReferenceKey() in /_/src/dotnet-svcutil/lib/src/CodeDomFixup/CodeDomHelpers.cs:line 29"

Expected behavior
The generated proxy contains no errors (a little message in visual studio in case of a failure would also be nice- I spent half a day looking for some nuget that I thought was missing- e.g. System.CodeDom seemed like a close match- so there had to be something like that..)

Additional context
If I remove the callback interface the same process completes as expected.

@lipchev lipchev changed the title svcutil: Null exception while generating duplex client svcutil: System.NullReferenceException while generating duplex client Oct 7, 2021
@lipchev
Copy link
Author

lipchev commented Oct 7, 2021

Great- after installing the tool from the locally built nuget (replacing referenceKey with s_referenceKey), I was able to get the correct Reference.cs.

Is there a way to update the package that ships with the IDE? I found it is installed under IDE\Extensions\Microsoft\WCF Connected Service but I don't suppose there is way to set a private nuget source for it somewhere?

@HongGit
Copy link
Contributor

HongGit commented Jun 24, 2022

The change is in, waiting to release soon.

@imcarolwang
Copy link
Contributor

The fix has been released to dotnet-svcutil, you can download the latest version of the tool from nuget.org to get the fix. Closing issue.

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

No branches or pull requests

3 participants