Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

razor class library build failed because staticwebassets.build.json was 0Bytes #59059

Open
1 task done
AdmiralSnyder opened this issue Nov 19, 2024 · 0 comments
Open
1 task done
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates

Comments

@AdmiralSnyder
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

i just had a weird issue on a coworker's pc for a razor class library project: the obj\Debug\net9.0\staticwebassets.build.json file was 0bytes and msbuild was very unhappy, throwing a json-parse-error (without telling us which file was the problem - i had to use the structured log viewer to find out)

We ended up deleting the obj/debug folder, but that feels like too much guesswork - a somewhat better error would have helped.

i don't know if this was the first time that solution got built in .net9 in debug mode - i know that a previous release build was successful.

Expected Behavior

either msbuild should complain about that file being 0 bytes
or the file should be filled correctly, in the first place
or the loading of that file should be tolerant to empty files

Steps To Reproduce

i have no idea why the generation of that file ended up with it being empty, and after we renaming the obj/debug folder, the issue didn't reappear...

i could provide a binlog of the failed compilation, though.

Exceptions (if any)

C:\Program Files\dotnet\sdk\9.0.100\Sdks\Microsoft.NET.Sdk.StaticWebAssets\targets\Microsoft.NET.Sdk.StaticWebAssets.targets(614,5): JsonException: The input does not contain any JSON tokens. Expected the input to start with a valid JSON token, when isFinalBlock is true. Path: $ | LineNumber: 0 | BytePositionInLine: 0.
bei System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, JsonReaderException ex)
bei System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& reader, T& value, JsonSerializerOptions options, ReadStack& state) bei System.Text.Json.Serialization.Metadata.JsonTypeInfo1.Deserialize(Utf8JsonReader& reader, ReadStack& state)
bei System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan1 utf8Json, JsonTypeInfo1 jsonTypeInfo, Nullable1 actualByteCount) bei Microsoft.AspNetCore.StaticWebAssets.Tasks.StaticWebAssetsManifest.FromJsonBytes(Byte[] jsonBytes) bei Microsoft.AspNetCore.StaticWebAssets.Tasks.GenerateStaticWebAssetsManifest.PersistManifest(StaticWebAssetsManifest manifest) bei Microsoft.AspNetCore.StaticWebAssets.Tasks.GenerateStaticWebAssetsManifest.Execute() JsonReaderException: The input does not contain any JSON tokens. Expected the input to start with a valid JSON token, when isFinalBlock is true. LineNumber: 0 | BytePositionInLine: 0. bei System.Text.Json.ThrowHelper.ThrowJsonReaderException(Utf8JsonReader& json, ExceptionResource resource, Byte nextByte, ReadOnlySpan1 bytes)
bei System.Text.Json.Utf8JsonReader.Read()
bei System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, T& value, JsonSerializerOptions options, ReadStack& state)
[D:\DevTools\Projects\DotNet\CODie\CustomerApp\CODieClientApp.Shared.Pages\CODieClientApp.Shared.Pages.csproj]

.NET Version

9.0.100

Anything else?

VS 2022 17.12.0

if there's any more info i could provide, i'd be glad to ask my coworker.
thanks a lot :-)

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates
Projects
None yet
Development

No branches or pull requests

1 participant