Fody.WeavingTask task fails unexpectedly (due to missing directory)
See original GitHub issueI 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:
- Created 5 years ago
- Reactions:3
- Comments:31 (17 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I unexpectedly got this error while looking into another issue, and I can’t explain the behavior I see:
This happens on the first build of https://github.com/jakubsuchybio/fody-costura-build-repro in an isolated environment (separate
globalPackagesFolder
innuget.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>
inFody.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 theFodyAssembly
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
can u try version 4.0.1