Unknown Rar Header: 238 #675

Closed
opened 2026-01-29 22:15:41 +00:00 by claunia · 3 comments
Owner

Originally created by @majorro on GitHub (Jan 21, 2025).

Exception:

SharpCompress.Common.InvalidFormatException: Unknown Rar Header: 238
   at SharpCompress.Common.Rar.Headers.RarHeaderFactory.TryReadNextHeader(Stream stream)
   at SharpCompress.Common.Rar.Headers.RarHeaderFactory.ReadHeaders(Stream stream)+MoveNext()
   at SharpCompress.Common.Rar.RarVolume.GetVolumeFileParts()+MoveNext()
   at SharpCompress.Readers.Rar.RarReader.GetEntries(Stream stream)+MoveNext()
   at SharpCompress.Readers.AbstractReader`2.NextEntryForCurrentStream()
   at SharpCompress.Readers.AbstractReader`2.MoveToNextEntry()

Code:

using var fs = File.Open("F:\\Rar.rar", FileMode.Open);
using var reader = ReaderFactory.Open(fs);
while (reader.MoveToNextEntry())
{
}

Happens when moving to the 8th track in archive

No issues with winrar

Originally created by @majorro on GitHub (Jan 21, 2025). Exception: ``` SharpCompress.Common.InvalidFormatException: Unknown Rar Header: 238 at SharpCompress.Common.Rar.Headers.RarHeaderFactory.TryReadNextHeader(Stream stream) at SharpCompress.Common.Rar.Headers.RarHeaderFactory.ReadHeaders(Stream stream)+MoveNext() at SharpCompress.Common.Rar.RarVolume.GetVolumeFileParts()+MoveNext() at SharpCompress.Readers.Rar.RarReader.GetEntries(Stream stream)+MoveNext() at SharpCompress.Readers.AbstractReader`2.NextEntryForCurrentStream() at SharpCompress.Readers.AbstractReader`2.MoveToNextEntry() ``` Code: ``` using var fs = File.Open("F:\\Rar.rar", FileMode.Open); using var reader = ReaderFactory.Open(fs); while (reader.MoveToNextEntry()) { } ``` Happens when moving to the 8th track in [archive](https://vk.com/doc322150273_437251882?hash=zE9Yxg87k384IbiReOcv0vvAiShZw6J4ngpE83PY0jP&dl=WueLvzsvyFCInvr1zuowseaFrt8bvUTlgZ1u96wyreT&api=1&no_preview=1) No issues with winrar
claunia added the bugup for grabs labels 2026-01-29 22:15:41 +00:00
Author
Owner

@Nanook commented on GitHub (Feb 6, 2025):

This error is raised when Visual Studio is set to raise all exceptions (full check). Set "Common Language Runtime Exceptions" to defaults (or off) and the archive can be processed without error.

Image

I've not tested moving directly to the 8th track though.

@Nanook commented on GitHub (Feb 6, 2025): This error is raised when Visual Studio is set to raise all exceptions (full check). Set "Common Language Runtime Exceptions" to defaults (or off) and the archive can be processed without error. ![Image](https://github.com/user-attachments/assets/2caaeffb-69b4-4891-a791-c3e08453fc1c) I've not tested moving directly to the 8th track though.
Author
Owner

@majorro commented on GitHub (Feb 6, 2025):

this error is raised when Visual Studio is set to raise all exceptions (full check)

I don't think so, just doublechecked the code without any ide/debug modes/etc. using dotnet run, it throws the error on 0.39.0
By moving to the 8th track I just meant iteration 7->8 btw

@majorro commented on GitHub (Feb 6, 2025): > this error is raised when Visual Studio is set to raise all exceptions (full check) I don't think so, just doublechecked the code without any ide/debug modes/etc. using `dotnet run`, it throws the error on 0.39.0 By _moving to the 8th track_ I just meant iteration 7->8 btw
Author
Owner

@Nanook commented on GitHub (Feb 6, 2025):

I used the unit test for rar2 (latest master/main). Replaced the name of file the test archive for your archive (full path). I had renamed the archive to .rar (from .rar1, although that won't matter). I think I had to set solid mode to true when calling the shared helper function. It extracted the full archive to the test scratch folder. I can check it out properly tomorrow

@Nanook commented on GitHub (Feb 6, 2025): I used the unit test for rar2 (latest master/main). Replaced the name of file the test archive for your archive (full path). I had renamed the archive to .rar (from .rar1, although that won't matter). I think I had to set solid mode to true when calling the shared helper function. It extracted the full archive to the test scratch folder. I can check it out properly tomorrow
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#675