Coder Social home page Coder Social logo

Comments (8)

jchristn avatar jchristn commented on July 16, 2024

Oooh, ouch. Thanks for sending this. Just confirmed this and will investigate!

from watsonwebserver.

jchristn avatar jchristn commented on July 16, 2024

Hi @at1993 I confirmed that the ResponseSent event never fires but am unable to reproduce the InvalidOperationException when a GET request comes in. Can you provide steps to reproduce?
image

from watsonwebserver.

at1993 avatar at1993 commented on July 16, 2024

Thanks for looking into the problem so promptly. The error may have suppressed when you test it in released mode. I tried it in debug mode via Visual Studio 2019.
exception

from watsonwebserver.

jchristn avatar jchristn commented on July 16, 2024

Thanks @at1993 - so this issue is not limited to just the Test.Events project, but any project including Test.Default (just confirmed).

So there are two issues:

  1. Even though the requests are being responded to and handled by the default route, somehow an InvalidOperationException is being thrown, and
  2. The ResponseSent callback is never being called

Can you confirm that requests are being handled as expected by your code aside from these two issues? Thanks!

from watsonwebserver.

jchristn avatar jchristn commented on July 16, 2024

For issue #1, changing from .RunSynchronously() to .Wait() resolves the issue.

For issue #2, I'll need to amend HttpResponse to keep a flag indicating whether or not a response was sent, and check the flag at the end of ThreadPool.QueueUserWorkItem((c) => ...

from watsonwebserver.

at1993 avatar at1993 commented on July 16, 2024

Thanks @jchristn .Wait() works for me. Just curious, Within the HttpResponse class, it does not signal (ResponseSent) at all when sending data is completed.

from watsonwebserver.

jchristn avatar jchristn commented on July 16, 2024

Correct, I have to fix that :) This and one other fix will be going into my next release. Cheers!

from watsonwebserver.

jchristn avatar jchristn commented on July 16, 2024

NuGet package published: https://www.nuget.org/packages/Watson/3.0.5

Commit: 657b75f

Changes:

- Removed ThreadPool.QueueUserWorkItem in favor of unawaited Tasks
- Removed .RunSynchronously in favor of .Wait for the default route, thereby eliminating an InvalidOperationException (thank you @at1993)
- Properly firing ResponseSent events when the event callback is defined (thank you @at1993)
- Fixed an issue where the file path for content routes was not properly constructed (thank you @zaksnet)
- Added better documentation on event callbacks

Thanks for your help and re-open this issue if there are any problems! Cheers

from watsonwebserver.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.