On Code Gallery, we have a plethora of samples that highlight aspects of the .NET Framework 4 that help with writing scalable and efficient parallel applications. This post examines each of those samples, providing an overview of what each provides.
Hi there. I downloaded the BlendImages_CSharp project and loaded into VS2010. There seem to be some missing files. I get the error message:
error : Unable to read the project file 'ParallelExtensionsExtras.csproj'
Thanks!
Kevin, thanks for letting us know. The problem was in the solution file, pointing to the ParallelExtensionsExtras.csproj file in the wrong directory. We've now re-uploaded the samples with a fixed .sln file. Thanks!
The samples are really great but they won't compile with VB Express 2010 only.
Peter, thanks for letting us know. We'll investigate.
I get a lot of exceptions trying to run the Mandlebrot sample, both the C++ and C# versions, ex:
System.OperationCanceledException was unhandled by user code
Message=The operation was canceled.
Source=mscorlib
StackTrace:
at System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Func`4 bodyWithLocal, Func`1 localInit, Action`1 localFinally)
at System.Threading.Tasks.Parallel.For(Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action`1 body)
at Microsoft.Pcp.Pfx.InteractiveFractal.MandelbrotGenerator.Create(MandelbrotPosition position, Int32 imageWidth, Int32 imageHeight, CancellationToken cancellationToken, Boolean parallelRendering) in C:\Users\baisa\Documents\Visual Studio 2010\Samples\ParallelProgrammingSamples_RC\MandelbrotFractals\MandelbrotFractals_CSharp\MandelbrotGenerator.cs:line 91
at Microsoft.Pcp.Pfx.InteractiveFractal.MainForm.<>c__DisplayClass2.<UpdateImageAsync>b__0() in C:\Users\baisa\Documents\Visual Studio 2010\Samples\ParallelProgrammingSamples_RC\MandelbrotFractals\MandelbrotFractals_CSharp\MainForm.cs:line 156
at System.Threading.Tasks.Task.Execute()
InnerException:
Hi Brad-
The issue here isn't in the code per se, but rather this is the debugger telling you that an exception is being thrown, even though the exception is actually going to be caught and handled. See http://blogs.msdn.com/pfxteam/archive/2010/01/11/9946736.aspx for more information. You can avoid this issue either by running without the debugger attached or by following the steps in the aforementioned blog post. This debugger behavior can often be helpful, however in this application, an exception is generated every time the scene changes, resulting in a poor experience.
I hope that helps.
Has anyone tried the Sudoku example in the newly released VB 2010 Express? Any issues? I'm an advanced hobbiest and like a challenge, but not too much (as in dealing with a sample that won't ever work in Express).
Bruce, the Sudoku sample should work fine with Visual Basic 2010 Express. If you have troubles with it, let us know.
Thanks. Is there a good list of limitations of Express in regard to parallel/PLINQ/tasks/etc? If so, where please?
Hi Bruce-
The .NET Framework 4 is installed as part of Express, and as such everything from TPL/PLINQ/etc. is available through Express, just as it's available to notepad if you just install the .NET Framework SDK. As such, there is no list of limitations, as it would be empty ;)
Now, from an IDE perspective, the new tooling we've built for Visual Studio 2010 (i.e. the Parallel Stacks and Parallel Tasks windows in the debugger, and the new Concurrency Visualizer) is not available in Express, but all of the framework support is there.
I just opened the Sudoku VB sln in VB Express 2010. I get a bunch of warnings. They all seem to be like one or the other of these two examples:
(1) Warning 1 Could not find type 'Microsoft.ParallelComputingPlatform.ParallelExtensions.Samples.Sudoku.Controls.TextStatefulButton'. (2) Warning 2 The variable 'tsbLoadPreviousGame' is either undeclared or was never assigned.
I just downloaded the samples within the last few days (of today, 4/19/10).
I suspect these warnings are all fixed by one reference or something. Please advise.
By the way, sweet deal on the no limitations in TPL/PLINQ functionality (except for the IDE stuff which I may have heard you talk about on DNR). Too bad there's not a VB 2010 Standard Edition (so, not free) that would include the concurrency IDE stuff. Oh well. Express is still amazing! Thanks for that!!!
I'm not sure why you're running into problems with the Sudoku example. I just installed Visual Basic 2010 Express onto a clean box, downloaded the samples, opened the Sudoku solution, compiled without any errors, ran, and it all worked fine. Are there any other errors besides the ones you mention? Is it possible the download somehow got corrupted? And you downloaded the samples from http://code.msdn.microsoft.com/ParExtSamples/Release/ProjectReleases.aspx?ReleaseId=4179, right?
There is a known issue with some of the other Visual Basic samples when using Express, in that they reference another project in the solution that's in C# (ParallelExtensionsExtras), but the Sudoku solution is standalone and does not need that other C# project.
toub,
I downloaded from the link you provided and it runs! So, no warnings. I'm not sure from where I downloaded before.
Thank you. (Now for the studying part!)
Hi toub,
i tried to run your SpellChecker application, but i got this error:
Error 3 The referenced assembly "C:\Documents\TestCode\ParallelExtensionsExtras\bin\Release\ParallelExtensionsExtras.dll" was not found. If this assembly is produced by another one of your projects, please make sure to build that project before building this one. SpellChecker_CSharp
Im using the 2008 version of Visual Studio - is this why im encountering these issues?
Thanks