rhasce

Member
Hi all hope it is all well.

I get this on Extensions/server/AttributesExt.cs line 488 and Misc/AttributesDefinicion.cs line 32 error below:

Feature `default literal' cannot be used because it is not part of the C# 7.0 language specification Please use language version 7.1 or greater
 
Hello I think this is messing me up, I tried 4.7.2 and back to the same error, how do I install 4.8 on Windows 10? Capture.PNG
When I set to 4.7.2 it compiles but same error, clearly I need .net 4.8 this is a fresh Publish 57 Servuo, fresh Windows install 🙁
 
Last edited:
Edit the properties for each project in the solution, change the target framework to .NET 4.8
You can do this by right clicking each project in the Solution Explorer panel in Visual Studio and selecting Properties.
 
With a fresh install of Servuo pub 57 I got the same errors as stated above (Feature 'default literal' is not available in C# 7.0. Please use language version 7.1 or greater.).

Followed the recommendation above and switched so that the projects uses framework 4.8 instead of 4.7.2 (scripts.csproj, Server.csproj, Ultima.csproj, app.config and ServUO.exe.config).

However I still get the same errors.. Voxpire, any idea if that doesn't work?
 
With a fresh install of Servuo pub 57 I got the same errors as stated above (Feature 'default literal' is not available in C# 7.0. Please use language version 7.1 or greater.).

Followed the recommendation above and switched so that the projects uses framework 4.8 instead of 4.7.2 (scripts.csproj, Server.csproj, Ultima.csproj, app.config and ServUO.exe.config).

However I still get the same errors.. Voxpire, any idea if that doesn't work?
This thread covers it; Vita-Nex 5.3.0.1 errors pub 57
 
It compiles, but I get this error. Since it does compile, I am taking it to be no big deal.
[VitaNexCore]: System.NullReferenceException: Object reference not set to an instance of an object.
at System.ObjectExtUtility.GetEventDelegates(Object obj, String eventName) in C:\Users\shado\OneDrive\Desktop\01122026\Scripts\Custom\Core-5.3.1.0\Extensions\System\ObjectExt.cs:line 60
at VitaNex.VitaNexCore.Configure() in C:\Users\shado\OneDrive\Desktop\01122026\Scripts\Custom\Core-5.3.1.0\VitaNex.cs:line 266
 
It compiles, but I get this error. Since it does compile, I am taking it to be no big deal.
Yes, warnings can generally be ignored.
You can fix that warning by adding a null-check;
Code:
Expand Collapse Copy
        private static readonly Delegate[] _EmptyDelegates = new Delegate[0];

        public static Delegate[] GetEventDelegates(this object obj, string eventName)
        {
            var t = obj as Type ?? obj.GetType();

            var f = _CommonFlags;

            if (t.IsSealed && t.IsAbstract)
            {
                f &= ~BindingFlags.Instance;
                f |= BindingFlags.Static;
            }

            var ei = t.GetEvent(eventName, f);

            if (ei == null)
            {
                return _EmptyDelegates;
            }

            var efi = t.GetField(ei.Name, f | BindingFlags.GetField);

            if (efi == null)
            {
                efi = t.GetField("EVENT_" + ei.Name.ToUpper(), f | BindingFlags.GetField);
            }

            if (efi == null)
            {
                return _EmptyDelegates;
            }

            var efv = (Delegate)efi.GetValue(obj is Type ? null : obj);

            return efv?.GetInvocationList() ?? _EmptyDelegates;
        }
 
Yes, warnings can generally be ignored.
You can fix that warning by adding a null-check;
Code:
Expand Collapse Copy
=csharp]
        private static readonly Delegate[] _EmptyDelegates = new Delegate[0];

        public static Delegate[] GetEventDelegates(this object obj, string eventName)
        {
            var t = obj as Type ?? obj.GetType();

            var f = _CommonFlags;

            if (t.IsSealed && t.IsAbstract)
            {
                f &= ~BindingFlags.Instance;
                f |= BindingFlags.Static;
            }

            var ei = t.GetEvent(eventName, f);

            if (ei == null)
            {
                return _EmptyDelegates;
            }

            var efi = t.GetField(ei.Name, f | BindingFlags.GetField);

            if (efi == null)
            {
                efi = t.GetField("EVENT_" + ei.Name.ToUpper(), f | BindingFlags.GetField);
            }

            if (efi == null)
            {
                return _EmptyDelegates;
            }

            var efv = (Delegate)efi.GetValue(obj is Type ? null : obj);

            return efv?.GetInvocationList() ?? _EmptyDelegates;
        }
Thanks hun
 

Donations

Total amount
$50.00
Goal
$500.00

Shards

Back