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.

What the check File.WriteAllBytes("testasm.dll", data) in tests?

See original GitHub issue


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

With the following error

    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:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

kekekekscommented, Oct 11, 2020

What happens if you change the file extension from dll to bin?

rstm-sfcommented, Oct 12, 2020

Ok, I added an extra condition on build for this in #31

Read more comments on GitHub >

github_iconTop 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 >

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 Post

No results found

github_iconTop Related Hashnode Post

No results found