I am trying to figure out a problem related to thread in ProvideValue for a custom markupextension. Somehow, the follow code will hang visual stuido and the breakpoint won't work. It seems access Thread.CurrentThread is not allowed in ProvidValue call.

Anyone know the reason

public override object ProvideValue(IServiceProvider serviceProvider)


System.Diagnostics.Debug.Print("manage id = ", Thread.CurrentThread.ManagedThreadId);





Re: Windows Presentation Foundation (WPF) thread question for MarkUpExtension => ProvideValue

Rob Relyea

I tested this with VS 2008 Beta2 (coming out very soon)...and I didn't have this problem.

So this is likely either: a fix in .Net or a fix in VS that you'll be able to use soon (Beta2 coming this week...)

Hope that helps.

Thanks, Rob

Rob Relyea | Program Manager, WPF & Xaml Language Team | /blog | /wpf | /xaml