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

Silence or fix some warnings #7562

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/AudioUnit/AUParameter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,16 @@ public string GetString (float? value)

public void SetValue (float value, AUParameterObserverToken originator)
{
#pragma warning disable CS0618
SetValue (value, originator.ObserverToken);
#pragma warning restore CS0618
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs review / comments, it hides something that should not happen.
IOW we should not depend on [Obsolete] API since we generally plan not to have them in XAMCORE_4_0. EIf a newer/better API exists then we should be using it (or we should comment why we can't)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The obsolete method points to this method.

Copy link
Contributor

@spouliot spouliot Dec 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The obsolete method points to this method.

yes, that's exactly my point :) something seems fishy and it needs to be reviewed (and if that's the right approach, some comments needs to be added)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixing this properly would probably mean modifying the generator so we generate 2 overloads, one for AUParameterObserverToken and one for the IntPtr version (compat one).

How would one modify the generator so it generates two methods and also forward AUParameterObserverToken to AUParameterObserverToken.ObserverToken

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving the non-disable warning fixes to a different PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

public void SetValue (float value, AUParameterObserverToken originator, ulong hostTime)
{
#pragma warning disable CS0618
SetValue (value, originator.ObserverToken, hostTime);
#pragma warning restore CS0618
}
}
#endif
Expand Down
6 changes: 6 additions & 0 deletions src/AudioUnit/AUParameterNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ public AUParameterObserverToken CreateTokenByAddingParameterObserver (AUParamete
if (observer == null)
throw new ArgumentNullException ("observer");

#pragma warning disable CS0618
IntPtr observerToken = TokenByAddingParameterObserver (observer);
#pragma warning restore CS0618

return new AUParameterObserverToken {
ObserverToken = observerToken
Expand All @@ -23,7 +25,9 @@ public AUParameterObserverToken CreateTokenByAddingParameterRecordingObserver (A
if (observer == null)
throw new ArgumentNullException ("observer");

#pragma warning disable CS0618
IntPtr observerToken = TokenByAddingParameterRecordingObserver (observer);
#pragma warning restore CS0618

return new AUParameterObserverToken {
ObserverToken = observerToken
Expand All @@ -32,7 +36,9 @@ public AUParameterObserverToken CreateTokenByAddingParameterRecordingObserver (A

public void RemoveParameterObserver (AUParameterObserverToken token)
{
#pragma warning disable CS0618
RemoveParameterObserver (token.ObserverToken);
#pragma warning restore CS0618
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/BusinessChat/BCChatAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public static void OpenTranscript (string businessIdentifier, Dictionary<BCParam
values [index] = new NSString (intentParameters [k]);
index++;
}
using (var dict = NSDictionary<NSString, NSString>.FromObjectsAndKeys (values, keys))
using (var dict = NSDictionary<NSString, NSString>.FromObjectsAndKeys (values, keys, keys.Length))
OpenTranscript (businessIdentifier, dict);
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/Foundation/NSFileManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,6 @@ internal static NSFileSystemAttributes FromDictionary (NSDictionary dict)
if (dict == null)
return null;
var ret = new NSFileSystemAttributes (dict);
ulong l = 0;
uint i = 0;
ret.Size = NSFileAttributes.fetch_ulong (dict, NSFileManager.SystemSize) ?? 0;
ret.FreeSize = NSFileAttributes.fetch_ulong (dict, NSFileManager.SystemFreeSize) ?? 0;
ret.Nodes = NSFileAttributes.fetch_long (dict, NSFileManager.SystemNodes) ?? 0;
Expand Down