Valheim
You are viewing a potentially older version of this package. View Latest Version
Install

Details

Date Uploaded
yesterday
Downloads
167
Size
145KB
Dependency string
korCaptain-NullReferenceFix-1.0.1
ADDatHost Valheim hosting
30% off!

NullReferenceFix

Tiny standalone patch for a long-standing vanilla Valheim bug: a NullReferenceException in ZNetScene.RemoveObjects that, once triggered, repeats every single frame for the rest of your play session, spamming the log and wasting CPU.

한국어 설명 보기 | English Description


🇰🇷 한국어 (Korean)

개요

NullReferenceFix는 발헤임 바닐라 엔진에 원래부터 있던 버그 하나를 고치는 아주 가벼운 단일 목적 모드입니다. 특정 몬스터/오브젝트 모드와 관계없이, 순수 바닐라 상태에서도 발생할 수 있는 문제입니다.


📦 필수 모드 (Dependencies)
모드 버전 필수 여부
BepInExPack_Valheim 5.4.2200+ 필수

그 외 의존성 없음. 다른 모드와 자유롭게 함께 설치 가능합니다.


🐛 어떤 버그인가요?

같은 프레임 안에서 어떤 ZNetView의 GameObject가 다른 경로로 먼저 파괴되면, 바닐라 ZNetScene.RemoveObjects가 그 오브젝트를 내부 추적 딕셔너리(m_instances)에서 제거하기도 전에 NullReferenceException을 던집니다. 이 예외 때문에 문제의 entry가 딕셔너리에서 끝내 제거되지 못하고 남아버리고, 그 결과 다음 프레임에도 똑같은 예외가 또 발생 — 이 과정이 세션이 끝날 때까지 매 프레임 무한 반복됩니다.

이건 특정 모드가 만든 버그가 아니라 발헤임 엔진 자체의 오래된 결함입니다. 모드를 하나도 설치하지 않아도 발생할 수 있으며, 몬스터 스폰/디스폰이 잦은 상황(전투, 대규모 소환 등)일수록 더 쉽게 걸립니다.


🔧 이 모드가 하는 일

ZNetScene.RemoveObjects에 Harmony Finalizer 패치 하나만 추가합니다:

  • 해당 NullReferenceException만 정확히 잡아냅니다 (다른 종류의 예외는 그대로 통과시킵니다).
  • 이미 파괴된(fake-null) ZNetView entry를 m_instances에서 직접 제거합니다.
  • 단순히 로그만 숨기는 게 아니라, 깨진 상태 자체를 정리해서 무한 반복을 실제로 멈춥니다.

다른 모드의 코드는 전혀 건드리지 않고, 오직 바닐라 ZNetScene만 패치합니다 — 어떤 모드팩에 넣어도 충돌 걱정 없이 사용 가능합니다.

회피(무시)가 아니라 청소입니다. 예외 자체는 처음 한 번은 그대로 발생하고, 이 모드가 그걸 잡아낸 뒤 원인이 된 깨진 entry를 실제로 지웁니다. 그래서 같은 entry로는 다시 터지지 않습니다 — 단순히 로그만 숨기고 깨진 상태를 계속 방치하는 방식이 아닙니다.


📥 설치 방법
  1. 권장: r2modman/Thunderstore에서 자동 설치
  2. 수동: NullReferenceFix.dllBepInEx/plugins/ 폴더에 복사

이 버그는 네트워크로 동기화되지 않는 로컬 상태 문제라서, 서버와 각 클라이언트가 각자 독립적으로 겪을 수 있습니다. 한쪽에만 설치하면 그쪽만 고쳐집니다 — 멀티플레이 환경이라면 서버 + 접속하는 모든 클라이언트에 설치하는 것을 권장합니다.


🏴󠁧󠁢󠁥󠁮󠁧󠁿 English

Overview

NullReferenceFix is a tiny, single-purpose mod that fixes one long-standing bug in vanilla Valheim itself. It has nothing to do with any specific monster/object mod — it can happen on a completely vanilla install too.


📦 Required Mods (Dependencies)
Mod Version Required
BepInExPack_Valheim 5.4.2200+ Required

No other dependencies. Safe to install alongside any other mods.


🐛 What's the bug?

If a ZNetView's GameObject is destroyed by something else in the same frame that vanilla ZNetScene.RemoveObjects tries to clean it up, the method throws a NullReferenceException before it can reach the line that removes the stale entry from its internal tracking dictionary (m_instances). Because that entry never gets removed, the exact same exception fires again on the very next frame — and every frame after that, for the rest of the session.

This is vanilla engine behavior, not something any particular mod causes. It can happen with zero mods installed; busier games (more monster spawns/despawns, heavy combat) simply hit the underlying race condition more often.


🔧 What this mod does

A single Harmony Finalizer patch on ZNetScene.RemoveObjects:

  • Catches only that specific NullReferenceException — any other exception passes through untouched.
  • Removes the already-destroyed (stale) ZNetView entry from m_instances directly.
  • This actually clears the broken state instead of just muting the log — the infinite loop stops for good, not just for one frame.

It doesn't touch any other mod's code, only vanilla ZNetScene — safe to drop into any modpack.

Cleanup, not evasion. The exception itself still fires once — this mod catches that one occurrence and then actually deletes the broken entry that caused it. The same entry can't throw again. It's not just hiding the log while leaving the broken state in place.


📥 Installation
  1. Recommended: Install via r2modman/Thunderstore
  2. Manual: Copy NullReferenceFix.dll into BepInEx/plugins/

This bug is local state, not something synced over the network — the server and each client can hit it independently. Installing on only one side only fixes that side. In multiplayer, install it on the server and every connected client to be safe.


🎮 My Other Mods / 함께 즐기면 더 좋은 모드

🌳 CaptainSkillTree

👹 MonsterModifiers

🎵 CaptainAudio


📝 Credits / 크레딧

  • Developer / 개발자: KorCaptain
  • Framework / 프레임워크: BepInEx, Harmony

💬 Support / 지원


📜 License / 라이선스

Developer - KorCaptain


Enjoy a quieter log file! / 조용해진 로그를 즐기세요!

Thunderstore development is made possible with ads. Please consider making an exception to your adblock.