Index: Source/BackEndClr/SharpGenerator.cobra
===================================================================
--- Source/BackEndClr/SharpGenerator.cobra	(revision 2419)
+++ Source/BackEndClr/SharpGenerator.cobra	(working copy)
@@ -1538,14 +1538,19 @@
 		if _initExpr
 			sw.write(' = ')
 			_initExpr.writeSharpDef(sw)
-		else if .type.isReference and not .type.nonNil inherits GenericParam
+		else if _canInitDefault 
 			sharpInit = .type.sharpInit
 			if sharpInit.length
 				sw.write(' = ')
 				sw.write(sharpInit)
 		sw.write(';\n')
+		
+	def _canInitDefault as bool
+		# In C# struct members can't be explicitly initted on declaration
+		if .compiler.boxStack.peek.sharpKeyWord == 'struct', return false
+		return .type.isReference and not .type.nonNil inherits GenericParam
+		
 
-
 class AbstractMethod
 	is partial
 
Index: Tests/140-structs/210-struct-init.cobra
===================================================================
--- Tests/140-structs/210-struct-init.cobra	(revision 0)
+++ Tests/140-structs/210-struct-init.cobra	(revision 0)
@@ -0,0 +1,46 @@
+# Test fix for Ticket:238. Default InitExprs not allowed in structs
+#struct-init.cobra(8): error: "St.Name": cannot have instance field initializers in structs (C#)
+#struct-init.cobra(19): error: "St1.X": cannot have instance field initializers in structs (C#)
+class XX
+	pass
+	
+struct St
+	var name as String
+	var n as int
+	
+	cue init(name as String, n as int)
+		.name = name
+		.n = n
+		
+#	def toString as String is override
+#		return 'St(name=[.name], n=[.n])'	
+	
+struct St1
+	var x as XX
+	var n as int
+	
+	cue init(x as XX, n as int)
+		.x = x
+		.n = n
+		
+#	def toString as String is override
+#		return 'St(x=[.x], n=[.n])'	
+		
+class Entry
+	def main is shared
+		x = St('xxx', 10)
+		assert x.name == 'xxx' and x.n == 10
+		
+		xx = XX()
+		x1 = St1(xx, 11)
+		assert x1.x == xx and x1.n == 11
+
+		# declare only and pack/unpack members explicitly
+		xa as St
+		#pack
+		xa.name = 'aaa'
+		xa.n = 12
+		#unpack
+		xa_name = xa.name
+		xa_n = xa.n
+		assert xa_name == 'aaa' and xa_n == 12
Index: Developer/IntermediateReleaseNotes.text
===================================================================
--- Developer/IntermediateReleaseNotes.text	(revision 2419)
+++ Developer/IntermediateReleaseNotes.text	(working copy)
@@ -477,3 +477,5 @@
 * Fixed: File and line number are duplicated in some compiler error messages.  ticket:212
 
 * Fixed: Some invariants cause an internal error.  ticket:248
+
+* Fixed: Bad codegen for structs containing strings (ref types).  ticket:238

