question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fody.WeavingTask task fails unexpectedly (due to missing directory)

See original GitHub issue

I am using Fody v3.3.3 with the PropertyChanged.Fody v2.6 weaver and I often get the MSB4018 error during build in Fody\build\Fody.targets(32,5). It shows the following stack-trace:

The "Fody.WeavingTask" task failed unexpectedly.
 System.IO.DirectoryNotFoundException: Could not find a part of the path '...\MyAmazingProject\obj\Debug\'.
    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, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
    at System.IO.StreamWriter.CreateFile(String path, Boolean append, Boolean checkHost)
    at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize, Boolean checkHost)
    at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding)
    at System.IO.File.WriteAllLines(String path, IEnumerable`1 contents)
    at Fody.WeavingTask.Execute()
    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()

When I check the directory does exist and when I build the failing project again, then sometimes it works. It’s quite random, but I have never seen this with v3.2.10.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:31 (17 by maintainers)

github_iconTop GitHub Comments

2reactions
ltrzesniewskicommented, Jan 12, 2019

I unexpectedly got this error while looking into another issue, and I can’t explain the behavior I see:

image

This happens on the first build of https://github.com/jakubsuchybio/fody-costura-build-repro in an isolated environment (separate globalPackagesFolder in nuget.config).

IntermediateCopyLocalFilesCache is supposed to be set to $(IntermediateOutputPath)$(FodyCopyLocalFilesCache) but $(FodyCopyLocalFilesCache) ends up blank. The target gets a directory path but it expects a file path, and it goes boom 💥 .

It seems that the <PropertyGroup> in Fody.targets was ignored (the Fody properties are clearly not set, as if the MSBuild evaluation phase was skipped), but the task is still called somehow, and it requires the FodyAssembly property to be set in order to be located in the first place.

If you restart VS then everything works fine afterwards. Also, everything works fine in the first place if you compile from the command line. This leads me to believe it’s a VS caching quirk, but has anyone experienced this kind of behavior before?

Here’s the VS binary build log: dir-not-found.zip

1reaction
SimonCroppcommented, Feb 11, 2019

can u try version 4.0.1

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fody.WeavingTask task fails unexpectedly with System. ...
I am on Fody 2.3.15 with Nullguard 1.6.3. The build environment uses MS Build 15.0. The devops build task was working fine in...
Read more >
Fody.WeavingTask task fails unexpectedly (due to missing ...
I am using Fody v3.3.3 with the PropertyChanged.Fody v2.6 weaver and I often get the MSB4018 error during build in Fody\build\Fody.targets(32,5).
Read more >
Newest 'fody' Questions - Stack Overflow
WeavingTask task fails unexpectedly with System.TypeInitializationException. I am on Fody 2.3.15 with Nullguard 1.6.3.
Read more >
MSBuild forum - RSSing.com
I am loading the project for first time,but it throws Error as following ... Fody.WeavingTask" task could not be loaded from the assembly...
Read more >
Xamarin Community Forums - RSSing.com
Error executing task Fody.WeavingTask: Required property 'IntermediateDir' not set. ```` The project was working and compiling well until I updated the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found