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

CS0200 - Serialization and internal/private sets #93

Closed
ferventcoder opened this issue Feb 10, 2015 · 0 comments
Closed

CS0200 - Serialization and internal/private sets #93

ferventcoder opened this issue Feb 10, 2015 · 0 comments

Comments

@ferventcoder
Copy link
Member

This seems to affect .NET 4.0, where an in place upgrade of .NET 4.5 works around it.

Reference: http://stackoverflow.com/q/23809092/18475

Error serializing type chocolatey.infrastructure.app.domain.Registry:
System.InvalidOperationException: Unable to generate a temporary class (result=1
).
error CS0200: Property or indexer 'chocolatey.infrastructure.app.domain.Registry
.RegistryKeys' cannot be assigned to -- it is read only
error CS0200: Property or indexer 'chocolatey.infrastructure.app.domain.Registry
.RegistryKeys' cannot be assigned to -- it is read only

   at System.Xml.Serialization.Compiler.Compile(Assembly parent, String ns, XmlS
erializerCompilerParameters xmlParameters, Evidence evidence)
   at System.Xml.Serialization.TempAssembly.GenerateAssembly(XmlMapping[] xmlMap
pings, Type[] types, String defaultNamespace, Evidence evidence, XmlSerializerCo
mpilerParameters parameters, Assembly assembly, Hashtable assemblies)
   at System.Xml.Serialization.XmlSerializer.GenerateTempAssembly(XmlMapping xml
Mapping, Type type, String defaultNamespace)
   at System.Xml.Serialization.XmlSerializer..ctor(Type type, String defaultName
space)
   at chocolatey.infrastructure.services.XmlService.serialize[XmlType](XmlType x
mlType, String xmlFilePath)
Unable to generate a temporary class (result=1).
error CS0200: Property or indexer 'chocolatey.infrastructure.app.domain.Registry
.RegistryKeys' cannot be assigned to -- it is read only
error CS0200: Property or indexer 'chocolatey.infrastructure.app.domain.Registry
.RegistryKeys' cannot be assigned to -- it is read only

It does appear that it may have something to do with permissions as well from the OP.

@ferventcoder ferventcoder self-assigned this Feb 10, 2015
@ferventcoder ferventcoder added this to the 0.9.9 milestone Feb 10, 2015
ferventcoder added a commit to ferventcoder/choco that referenced this issue Feb 10, 2015
When using private or internal sets, some systems will run into the
CS0200 issue. The error manifests itself in the following manner:

```
Error serializing type chocolatey.infrastructure.app.domain.Registry:
System.InvalidOperationException: Unable to generate a temporary class
(result=1
).
error CS0200: Property or indexer
'chocolatey.infrastructure.app.domain.Registry
.RegistryKeys' cannot be assigned to -- it is read only
error CS0200: Property or indexer
'chocolatey.infrastructure.app.domain.Registry
.RegistryKeys' cannot be assigned to -- it is read only
```

Leaving a note where it is required not to convert to private sets,
even though that is preferred and making the set public is how this
error is avoided.
ferventcoder added a commit to ferventcoder/choco that referenced this issue Feb 12, 2015
* stable:
  (version) 0.9.9-rc6
  (chocolateyGH-7) Upgrade improvements
  (chocolateyGH-99) Warn when admin is not elevated
  (log) update what confirm (`-y`) does
  (chocolateyGH-82) Set Modify for Installing User
  (chocolateyGH-91) Terminating errors - choco upgrade fail
  (chocolateyGH-7) Check debug env var for 'true'
  (maint) fix logging message
  (chocolateyGH-97) Noop shows number of upgrades available
  (chocolateyGH-91) Remove global ErrorActionPreference Stop
  (command) accept features as alias
  (chocolateyGH-7) warn when install is not done in admin mode
  (doc) add changelog for 0.9.8.33
  (posh) dynamically export helpers
  (chocolateyGH-87) Backup improvements
  (chocolateyGH-94) Remove rollback on success
  (chocolateyGH-87) shorten rollback suffix
  (chocolateyGH-93) Avoid CS0200 Serialization w/private set
  (chocolateyGH-92) PowerShell - handle spaces in module path
  (shimgen) Fix company name on shims
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants