tmauldin / mb-unit

Automatically exported from code.google.com/p/mb-unit
0 stars 0 forks source link

Path.GetTempPath() causing unhandled exception #759

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I've got a test that's failing because of an assert that I currently expect to 
fail.  But every time the test run finishes, I get a popup that says "An 
exception occured in an event handler" and if I click details here's the full 
dump I get.

Looking at the full path to where Gallio is running from, the length of the 
path is only 34 chars.  The full path to where the project .dll resides is only 
60 chars.

Gallio Icarus version 3.2 build 601 (x86) on Windows 7 (x64)

Any ideas?

System.IO.PathTooLongException: The specified path, file name, or both are too 
long. The fully qualified file name must be less than 260 characters, and the 
directory name must be less than 248 characters.
   at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength)
   at System.IO.FileInfo..ctor(String fileName)
   at Gallio.Common.Caching.SimpleDiskCache.Group.OpenFile(String relativeFilePath, FileMode mode, FileAccess access, FileShare share) in c:\Server\Projects\MbUnit v3.2\Work\src\Gallio\Gallio\Common\Caching\SimpleDiskCache.cs:line 203
   at Gallio.UI.Reports.HtmlTestStepRunFormatter.SaveAttachment(String stepId, AttachmentData attachmentData)
   at Gallio.UI.Reports.HtmlTestStepRunFormatter.SaveAttachments(TestStepRun stepRun)
   at Gallio.UI.Reports.HtmlTestStepRunFormatter.TestStepReportWriter.RenderTestStepRun(TestStepRun testStepRun, Int32 nestingLevel, Boolean flashEnabled)
   at Gallio.UI.Reports.HtmlTestStepRunFormatter.TestStepReportWriter.RenderTestStepRun(TestStepRun testStepRun, Int32 nestingLevel, Boolean flashEnabled)
   at Gallio.UI.Reports.HtmlTestStepRunFormatter.TestStepReportWriter.RenderTestStepRun(TestStepRun testStepRun, Int32 nestingLevel, Boolean flashEnabled)
   at Gallio.UI.Reports.HtmlTestStepRunFormatter.TestStepReportWriter.RenderTestStepRun(TestStepRun testStepRun, Int32 nestingLevel, Boolean flashEnabled)
   at Gallio.UI.Reports.HtmlTestStepRunFormatter.TestStepReportWriter.RenderReport(IEnumerable`1 rootRuns)
   at Gallio.UI.Reports.HtmlTestStepRunFormatter.Format(ICollection`1 stepRuns, TestModelData modelData)
   at Gallio.UI.Reports.TestStepRunViewer.Show(ICollection`1 testStepRuns, TestModelData testModelData)
   at Gallio.Common.Policies.EventHandlerPolicy.SafeInvoke[T](EventHandler`1 handlerChain, Object sender, T e) in c:\Server\Projects\MbUnit v3.2\Work\src\Gallio\Gallio\Common\Policies\EventHandlerPolicy.cs:line 69
Reported by:
UnhandledExceptionPolicy
   at Gallio.Icarus.Controllers.ExecutionLogController.<Update>b__1(Report report)
   at Gallio.Common.Concurrency.LockBox`1.Read(ReadAction`1 action) in c:\Server\Projects\MbUnit v3.2\Work\src\Gallio\Gallio\Common\Concurrency\LockBox.cs:line 61
   at System.Threading.ExecutionContext.runTryCode(Object userData)
   at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

Original issue reported on code.google.com by Drogo...@gmail.com on 20 Oct 2010 at 5:33

GoogleCodeExporter commented 9 years ago
Out of interest, what is %temp% for you?

Original comment by grahamr...@gmail.com on 20 Oct 2010 at 8:34

GoogleCodeExporter commented 9 years ago
C:\Users\rjenkins\AppData\Local\Temp

Original comment by Drogo...@gmail.com on 20 Oct 2010 at 8:37

GoogleCodeExporter commented 9 years ago
Hmm, that doesn't sound like 248 chars!

Original comment by grahamr...@gmail.com on 20 Oct 2010 at 8:59

GoogleCodeExporter commented 9 years ago
So I discovered the source of the problem and (surprise, surprise) it existed 
between the chair and keyboard.

I was logging a screenshot of the failure and looking at the 
TestLog.EmbedImage(  I was passing a string that was much too large as the 
first parameter attachmentName, trying to use it as more of a caption than a 
file name.

I've altered my code to severely truncate what I pass as that parameter and all 
is well.

So I guess this bug just needs to protect people like me from themselves when 
they pass a too-large string to TestLog.EmbedImage()

Original comment by Drogo...@gmail.com on 12 Nov 2010 at 9:35

GoogleCodeExporter commented 9 years ago
Fixed in r3119.

Original comment by grahamr...@gmail.com on 26 Feb 2011 at 8:46

GoogleCodeExporter commented 9 years ago

Original comment by Yann.Tre...@gmail.com on 14 Jun 2011 at 5:48