What the check File.WriteAllBytes("testasm.dll", data) in tests?
See original GitHub issueHello!
I am thinking to add github actions and, accordingly, restore tests. I have updated the nuget packages and upgraded to netcoreapp 3.1. But the chair ran into the fact that my tests fall in this place https://github.com/kekekeks/XamlX/blob/697a419675a8055b7ef9a1904360359522b30616/tests/CecilTests/CompilerTestBase.cs#L60
With the following error
Message:
System.IO.IOException : The process cannot access the file '.\XamlX\tests\CecilNetstandardTests\bin\Debug\netcoreapp3.1\testasm.dll' because it is being used by another process.
Stack Trace:
FileStream.ValidateFileHandle(SafeFileHandle fileHandle)
FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options)
FileStream.ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
FileStream.ctor(String path, FileMode mode, FileAccess access, FileShare share)
File.InternalWriteAllBytes(String path, Byte[] bytes)
File.WriteAllBytes(String path, Byte[] bytes)
CompilerTestBase.Compile(String xaml) line 75
BasicCompilerTests.Compiler_Should_Compile_Simple_Xaml(Boolean populate) line 27
If I comment out, most of the tests pass (I don’t think those test pairs are related to this). What this check?
P.S. If necessary, you can try, for example, using System.IO.Abstractions.TestingHelpers, writing something like this
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
File.WriteAllBytes(String, Byte[]) Method (System.IO)
Creates a new file, writes the specified byte array to the file, and then closes the file. If the target file already exists,...
Read more >visual studio - Unit testing: how to access a text file?
I'm using Visual Studio 2008 with Microsoft test tools. I need to access a text file from within the unit test.
Read more >Thread: WriteAllText --> WriteAllBytes
Hi, I have a text variable 'outputText'. This variable can be written to text file like: IO.File.WriteAllText(IO.Path.Combine(Application.
Read more >File.WriteAllBytes() Method in C# with Examples
WriteAllBytes (String) is an inbuilt File class method that is used to create a new file then writes the specified byte array to...
Read more >Is it considered 'bad practice' to check file contents ...
I would not focus to much on what is or isn't a unit test and realize ... It is bad practice to call...
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
What happens if you change the file extension from
dll
tobin
?Ok, I added an extra condition on build for this in #31