CreateNewLangProj throws when the default analysis writing system's ICU locale differs from its tag

Abierto Apto para principiantes
#416 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
76/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
csharp
Área
backend

Línea de trabajo

Empieza con LcmCache.CreateNewLangProj y sigue cómo InitializeAnthroList elige el sistema de escritura cuando no se proporciona ningún archivo de lista de antropología; compara esa búsqueda con CreateAnalysisWritingSystem, que el issue menciona como ejemplo existente. Reproduce el caso con la llamada pt-BR proporcionada y confirma que se realiza correctamente sin dejar una tarea abierta ni provocar una excepción al liberar la caché.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

LcmCache.CreateNewLangProj throws when no anthropology list file is passed and the default analysis writing system's ICU locale differs from its language tag. pt-BR is one such writing system: its ICU locale is pt_BR.

Cause

With no list file, InitializeAnthroList names the empty Anthropology Categories list in the default analysis writing system. It finds that writing system with:

cache.WritingSystemFactory.GetWsFromStr(analWrtSys != null ? analWrtSys.IcuLocale : userIcuLocale)

GetWsFromStr looks writing systems up by language tag. For pt-BR it gets pt_BR, returns 0, and set_String(0, ...) throws. By then the project is already on disk.

FLEx's new-project dialog passes the FRAME list by default, so FLEx only hits this when the user picks an empty, user-defined list. Callers that create projects without a list file hit it every time.

Repro

LcmCache.CreateNewLangProj(progress, "Test", dirs, synchronizeInvoke,
    new CoreWritingSystemDefinition("pt-BR") { Id = "pt-BR" },
    new CoreWritingSystemDefinition("fr") { Id = "fr" }, "en",
    new HashSet<CoreWritingSystemDefinition>(), new HashSet<CoreWritingSystemDefinition>(), null);

The real exception is hidden. The failed call leaves a non-undoable task open, so disposing the cache throws SynchronizationLockException.

Fix

Look the writing system up by analWrtSys.Id, as CreateAnalysisWritingSystem already does.

Lenguaje dominante
C#
Estrellas
3
Forks
15
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de sillsdev/liblcm

Todos los issues de sillsdev/liblcm

Issues similares

Más issues de C#

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.