InitializeBuildProjectContext on first build of clean source

Sysprogs forums Forums VisualGDB InitializeBuildProjectContext on first build of clean source

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #32375
    dabramson
    Participant

    I have a solution with a firmware project and a unit test project. The unit test project is set to generate the testcontainer file because I need it for CI build. When I get a fresh clone of the solution and build it for the first time, the firmware project builds without issue, but the unit test project fails to build with the following failure:

    The "InitializeBuiltProjectContext" task failed unexpectedly.
    System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\apl\APL\ADM\VisualGDB\Debug\TestADM1.vgdbtestcontainer'.
    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
    at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
    at BSPEngine.XmlTools.SaveObject(Object obj, String xmlFile, Type[] extraTypes)
    at ud.d(String a, String c, String b, ReferencedProjectInformation[] e, TestContainerGenerationContext d)
    at Sysprogs.Build.Tasks.InitializeBuiltProjectContext.Execute()
    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()

    But the second attempt to build is fine. I think it should build the first time without error, especially considering I may want at least one of the CI builds to start with a clean slate everytime.

    Why would the testcontainer file even matter before the project is built? Of course it won’t be there, the project wasn’t built yet.

    After a little experimenting I find that if I build ONLY the unit test project with a fresh clone, it will not build the 1st, 2nd, 3rd, to the nth time. But once I build the firmware project, which creates the VisualGDB\Debug\ directory, the unit test project builds the first time. So it seems like when I build the solution it is actually the unit test project that starts to build first, but fails because the firmware project hasn’t got around to creating the output directory yet. In any case, it still doesn’t make sense for the unit test project to be complaining about missing a file in an output directory, before building the project, when that directory is created by building the project. Note that once the directory is there, it does not complain about the testcontainer file not being there.

    #32383
    support
    Keymaster

    Hi,

    This looks like a rather complex setup that contains some rare combination of settings triggering unexpected behavior. The best way of troubleshooting it would be to reproduce it on a clean project from scratch and document the exact steps it takes to trigger the issue. Most likely, the issue will start happening after you change some specific setting.

    If you can describe the setting that triggers the issue (or the entire repro steps with the relevant screenshots), we should be able to suggest a fix/workaround.

    #32384
    dabramson
    Participant

    The setting that triggers the issue is under project property pages, Configuration Properties->General->Generate a test container file (see screenshot).

    When it is set to yes, <SolutionDir>VisualGDB\<BuildConfig> directory must exist BEFORE building. Otherwise the build does not work, and you get the exception from the original post.

    If I delete the directory and build with this setting, the build fails. If I delete only the CONTENTS of the directory and build with this setting, the build passes.

    I watched the contents of the empty directory while building, and the .vgdbtestcontainer file gets placed there before any of the linker outputs. So there is an obvious work around for CI builds (pre-create <SolutionDir>VisualGDB\<BuildConfig> if it isn’t there). But there is a fairly trivial (in my view) issue here where turning on a setting causes a failure because a file is being placed in a directory that may not exist, and there is nothing to create the directory if it doesn’t exist.

    I’ve used this setting in the past an not had this issue. I did note that the contents of the file are now xml, whereas this tutorial , at step 21, says it is just a text file…so there appears to be some kind of change in this area.

    Attachments:
    You must be logged in to view attached files.
    #32393
    support
    Keymaster

    Thanks for narrowing it down. Indeed, the directory would usually be created by other MSBuild targets, so InitializeBuiltProjectContext did not need to do it. It is hard to say why this project is different, but we have simply added an extra check for creating the directory if it was missing. Please feel free to try this build: VisualGDB-5.6.104.4545.msi

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.