ical.net: PRODID not being respected after upgrade from v2 to v4
Hi,
I just upgraded from v2 to v4. After getting the code to recompile and changing all the lower case values to upper case, I am left with one difference that is showing up in my unit tests.
The ProductId of the calendar isn’t being respected when serializing calendar events. I used to set the productId and serialize an event like this:
var calendar = new Ical.Net.Calendar
{
ProductId = "-//www.skycourt.ca//RemoteAPI/EN"
};
calendar.Events.Add(ev);
var serializer = new CalendarSerializer(new SerializationContext());
now that ProductId string comes out like this:
PRODID:-//github.com/rianjs/ical.net//NONSGML ical.net 4.0//EN
Is there a way to get the prodid to be set to the value I want?
About this issue
- Original URL
- State: open
- Created 6 years ago
- Comments: 15 (1 by maintainers)
It’s also possible to use
ComponentSerializerinstead ofCalendarSerializer, which doesn’t have the issue.Yep, just got bit by this too – if I’m specifically setting a ProductId then I want it rendered and may be looking for that value elsewhere to know that I’ve generated it.
IMO, the current method of just straight overriding is bad news. If you’re going to do that, make the property read only.
My proposal:
@rianjs I know you’re short on time, so I’m happy to do a PR to solve this, if it will be accepted.
@randbrown I am using the following code as a workaround: