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

Assembly suffix not supported by xsi:type and NLog.xsd #4978

Open
snakefoot opened this issue Jun 18, 2022 · 5 comments
Open

Assembly suffix not supported by xsi:type and NLog.xsd #4978

snakefoot opened this issue Jun 18, 2022 · 5 comments

Comments

@snakefoot
Copy link
Contributor

snakefoot commented Jun 18, 2022

When using this format:

<target xsi:type="Syslog, NLog.Targets.Syslog" name="cee-udp">

Then one gets the following XML schema-validation error:

image

Maybe add support for having assembly-name as prefix:

<target xsi:type="NLog.Targets.Syslog:Syslog" name="cee-udp">

Curious is the XML Schema validation is still able to validate properties for the SysLog-target when using NLog.Targets.Syslog: as prefix? (Seems intellisense works when doing this xsi:type="NLog:File")

See also #4300 + #4308

See also: luigiberrettini/NLog.Targets.Syslog#307

@davidgeary
Copy link

AFAICS, the only place this new capability of including the assembly name is mentioned is in the list of NLog 5.0 changes:

This means custom targets requires explicit <add assembly="NLog.MyAssembly" />, or use the new ability to specify type with assembly-name: <target type="MyTarget, NLog.MyAssembly" name="hello" />.

It would be useful if this could be added to the documentation of the target configuration too.

@snakefoot
Copy link
Contributor Author

snakefoot commented Jun 20, 2022

It would be useful if this could be added to the documentation of the target configuration too.

If you have found a NLog-wiki-page that needs to be updated, then you are wellcome to make the change yourself, or you can point out where something is missing.

@snakefoot
Copy link
Contributor Author

snakefoot commented Jun 22, 2022

Looks like xsi:type="myprefix:mytype" requires that one have defined the prefix upfront with xmlns:myprefix="..".

So abusing myprefix as assembly-loading-hint might break other stuff in XML / XSD-tooling for validation / intellisense. Guess we need an adult to help us out.

@ThomasArdal
Copy link

When reading through all of the different issues spread across repositories about this issue, I think that I have come to the conclusion that the xsi:type attribute isn't the right place to put the assembly information. I believe I was the one pushing for a .NET fully qualified name-type of format here. This was definitely a mistake and my lack of XML Schema knowledge led to a poor suggestion from my side there.

I can see how this could be implemented:

myprefix:assembly:logname

But I'm not sure it's a good idea or even parses schema validation. Also, parsing this string could be bit of a problem since myprefix would not always be there.

In the end, the idea behind the feature (if I remember correctly) was to avoid having to declare the extensions element in config. The assembly attribute directly on the target element (suggested somewhere else) is my favorite I believe.

Just a bit of input. There are definitely adults out there with more XML Schema knowledge than me so maybe something is possible there that I couldn't manage to dig up in the XML Schema docs 🤷‍♂️

@snakefoot
Copy link
Contributor Author

snakefoot commented Jun 23, 2022

I think I will step away from the crime-scene, and let those who with knowledge about xsi:type and xmlns take over, and provide a proper pull-request.

Think my contribution is just showing how one should not do it :)

@snakefoot snakefoot changed the title Assembly suffix not supported by NLog.xsd Assembly suffix not supported by xsi:type and NLog.xsd Jun 23, 2022
@snakefoot snakefoot removed this from the 5.0.2 milestone Jun 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants