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

Paket.PowerShell support for Package Manager Console #875

Merged
merged 6 commits into from
Jun 18, 2015

Conversation

ctaggart
Copy link
Contributor

This is for #874 and is not ready yet to be merged. It is in progress and ready for review. I could use some help solving the async / trace dilemma. PowerShell requires that the tracing be on the same thread and it appears async puts it on another.

@forki forki changed the title refactor Logging to use Trace observable WIP: refactor Logging to use Trace observable Jun 15, 2015
restore the lock for the console trace to allow multiple threads
let id = Threading.Thread.CurrentThread.ManagedThreadId
Logging.subscribe (fun trace ->
if id = Threading.Thread.CurrentThread.ManagedThreadId then
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This thread ID check appears it will work. Messages in async will not print, but also will not error out the program now.

@ctaggart
Copy link
Contributor Author

I asked around at work about how to get all the messages on the same thread. I was told to look at Async.SwitchContext. There is some good related code already in Utils.fs. Hoping that I can capture SynchronizationContext.Current instead of the ManagedThreadId and use it to put all the messages on the right thread for PowerShell. I'll try it out tonight.

@ctaggart
Copy link
Contributor Author

I spent hours on this, this evening, without any luck. I opened up a stackover question:
http://stackoverflow.com/questions/30859885/post-messages-on-async-thread-to-original-thread-in-f

@ctaggart ctaggart changed the title WIP: refactor Logging to use Trace observable refactor Logging to use Trace observable Jun 18, 2015
@ctaggart
Copy link
Contributor Author

I believe this is ready to go. Logging now works correctly in PowerShell and in Package Manager Console. It displays output as it goes.

image

image

I created type EventSink and function processWithLogging to allow the trace messages to be output on the main PowerShell thread, which is required by PowerShell (according to the error messages I get when I don't do so).

@ctaggart ctaggart changed the title refactor Logging to use Trace observable Paket.PowerShell support for Package Manager Console Jun 18, 2015
@ctaggart
Copy link
Contributor Author

The feature is Paket.PowerShell support for Paket Manager Console and to add support I had to refactor Logging to use Trace observable.

forki added a commit that referenced this pull request Jun 18, 2015
Paket.PowerShell support for Package Manager Console
@forki forki merged commit 6943857 into fsprojects:master Jun 18, 2015
@forki
Copy link
Member

forki commented Jun 18, 2015

cool. thanks

@forki
Copy link
Member

forki commented Jun 18, 2015

maybe it even fixes the logging issues in paket.vs - you never know ;-)

@forki
Copy link
Member

forki commented Jun 20, 2015

Did this by any chance changed the exit code behavior? It seems we always get exit code 1 - even on success.

@ctaggart
Copy link
Contributor Author

:/ I'll have a look.

@forki
Copy link
Member

forki commented Jun 20, 2015

I mean it's probably something different, but I have no idea at the moment
On Jun 20, 2015 8:18 PM, "Cameron Taggart" [email protected] wrote:

:/ I'll have a look.


Reply to this email directly or view it on GitHub
#875 (comment).

@ctaggart
Copy link
Contributor Author

Looking at the changes I made to Program.fs, I think I see this issue.

@ctaggart
Copy link
Contributor Author

@forki Just to be clear, the exit code wasn't broken. What was broken was the exception not being logged.

@forki
Copy link
Member

forki commented Jun 23, 2015

I tried to update Paket.VisualStudio and got:

image

What do I need to do?

@ctaggart
Copy link
Contributor Author

Paket.Logging.event is public. event.Publish can be subscibed to.
On Jun 23, 2015 1:32 AM, "Steffen Forkmann" [email protected]
wrote:

I tried to update Paket.VisualStudio and got:

[image: image]
https://cloud.githubusercontent.com/assets/57396/8301978/1e504036-1993-11e5-88bf-60f4f1eb7fdc.png

What do I need to do?


Reply to this email directly or view it on GitHub
#875 (comment).

@forki
Copy link
Member

forki commented Jun 24, 2015

image

I don't get it working. Could you please help me a bit? thx

@dungpa
Copy link
Contributor

dungpa commented Jun 24, 2015

@forki
Copy link
Member

forki commented Jun 24, 2015

fsprojects/Paket.VisualStudio@8bb932a does this look OK?

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

Successfully merging this pull request may close these issues.

3 participants