C# Setting value on enum member variable of a singleton, lags the Unity editor

I have a singleton implemented with static instance variable approach.
When I set one of it’s member variable of enum type, the editor lags and I have to force quit it everytime that happens.

public class SharedData {

	private static SharedData m_onlyInstance = null;

	
	public int a,b,c;
	public ESampleType eType = ESampletype.Default;
	
	
	public static SharedData Instance {
		get {
			if (m_onlyInstance == null) {
				m_onlyInstance = new SharedData();
			}
			return m_onlyInstance;
		}
	}
	//other codes...
}

public class TestClass : MonoBehaviour {

	[SerializeField]
	Slider m_sliderTest;

	public void onStartBtn(){
		
		Debug.Log("---START---");
		
		SharedData data = SharedData.Instance;
		
		ESampleType eType = (ESampleType)(int)m_sliderTest.value;
		
		data.a = 1;
		data.eType = eType;  //***when I commented this line, the lag disappear.
		data.b = 2;
		data.c = 3;
		
		Debug.Log("---END---");
		
	}
    //other codes...
}

Also, the log "---START---" and "---END---" won’t show up when the problematic line is there. It seems doesn’t compile well. It’s very weird!

Is this a limitation on C#? Please help me what’s happening here. I need to fix this problem.

My Unity editor version is 5.4.1.40776.

This most likely is not directly related to that method you’ve showed, The reason why the logs aren’t visible is most likely because your game freezes within the same frame due to another problem somewhere else so the editor won’t has a chance to update the console and thus the logs aren’t visible.

From where is “onStartBtn” called and is that the whole method? So Debug.Log("---END---"); is the last statement inside that method?

“Lag” and “freeze” are two completely different symptomes. The way you describe your case it sounds more like a freeze.

When it doesn’t freeze when you uncomment the assignment of your enum value, it might be related to a point where you actually read your “data.eType” value.

It would also help to understand your code better if we know how that enum type is defined.